Search
CompositeNode.LoadJsonTemplate Method
See Also
 





Loads the item's components from a Json template.

Namespace: MindFusion.Diagramming
Package: MindFusion.Diagramming

 Syntax

C#  Copy Code

public void LoadJsonTemplate (
    string template
)

Visual Basic  Copy Code

Public Sub LoadJsonTemplate( _
    template As String _
)

 Parameters

template

A Json template string containing the item's components data.

 Example

Components can be defined in JSON format as shown in this example:

C#  Copy Code
 string template = @"{
 ""component"": ""SimplePanel"",
 ""children"":
 [
  {
   ""component"": ""Shape"",
   ""name"": ""Frame"",
   ""pen"": ""black"",
   ""strokeThickness"": 0.2,
   ""isOutline"": true,
   ""autoProperty"": true
  },
 {
 ""component"": ""GridPanel"",
 ""rowDefinitions"": [""*""],
 ""columnDefinitions"": [""22"", ""*""],
 ""children"":
 [
  {
   ""component"": ""Image"",
   ""name"": ""Image"",
   ""autoProperty"": true,
   ""location"": ""../Images/icon4.png"",
   ""margin"": ""1"",
   ""imageAlign"": ""Fit""
  },
        {
          ""component"": ""Button"",
         ""brush"": ""red"",
         ""textColor"": ""#fff"",
         ""font"": ""Arial bold"",
         ""text"": ""x"",
         ""cornerRadius"": 3.5,
         ""width"": 6,
         ""height"": 6,
         ""clickHandler"": ""onDeleteClick""
        },
  {
   ""component"": ""StackPanel"",
   ""orientation"": ""Vertical"",
   ""gridColumn"": 1,
   ""margin"": ""1"",
   ""verticalAlignment"": ""Near"",
   ""children"":
   [
    {
     ""component"": ""Text"",
     ""name"": ""Title"",
     ""autoProperty"": true,
     ""text"": ""title"",
     ""font"": ""Arial bold""
    },
    {
     ""component"": ""Text"",
     ""name"": ""FullName"",
     ""autoProperty"": true,
     ""text"": ""full name"",
     ""pen"": ""blue"",
     ""padding"": ""1,0,1,0"",
     ""enableStyledText"": true
    },
    {
     ""component"": ""Text"",
     ""name"": ""Details"",
     ""autoProperty"": true,
     ""text"": ""details"",
     ""font"": ""Arial 3""
    }
   ]
  }
 ]
}]}
"

 See Also