Attached script implements simple button components, with image, imageAlign and text properties so far (unlike Windows Forms where you can place other components as buttons' contents).
@{
string template = @"{
""component"": ""GridPanel"",
""rowDefinitions"": [""6"", ""*""],
""columnDefinitions"": [""6"", ""*""],
""children"":
[
{
""component"": ""Shape"",
""id"" : ""RoundRect"",
""columnSpan"": 2,
""rowSpan"": 2,
""margin"": ""2"",
""brush"": ""skyblue"",
""pen"": ""skyblue""
},
{
""component"": ""Text"",
""columnSpan"": 2,
""rowSpan"": 2,
""margin"": ""3,5,3,1"",
""text"": ""some node contents""
},
{
""component"": ""ButtonComponent"",
""gridColumn"": 0,
""gridRow"": 0,
""brush"": ""#ccc"",
""imageLocation"": ""../Content/close-all.png"",
""imageAlign"": ""Center"",
""cornerRadius"": 3.5,
""clickHandler"": ""onDeleteClick""
}
]
}
";
function onDeleteClick(sender, args)
{
var item = args.getItem();
item.getParent().deleteItem(item);
}
Regards,
Slavcho