Finished demo

This commit is contained in:
Zihan Chen
2021-06-18 20:24:47 -07:00
parent 868e318c8a
commit a59ce7eb44
5 changed files with 51 additions and 26 deletions
@@ -42,8 +42,13 @@
var tct = cast (TabWindowTabTemplate*) tab.ControlTemplateObject;
tct.SetTabHeaderContainer(wct.TabHeaderContainer);
tab.Pages.Add(new LoremIpsumTabPage*());
tab.Pages.Add(new LoremIpsumTabPage*());
attach(tct.AddPageRequested, func():void
{
var tabPage = new LoremIpsumTabPage*();
tab.Pages.Insert(0, tabPage);
tab.SelectedPage = tabPage;
});
tab.Pages.Add(new LoremIpsumTabPage*());
}
]]></ref.Ctor>
@@ -42,6 +42,8 @@
headerContainer.AddChild(headerTable);
}
}
event AddPageRequested();
]]>
</ref.Members>
<TabTemplate ref.Name="self" ContainerComposition-ref="container" TabOrder="LeftToRight" MinSizeLimitation="LimitToElementAndChildren">
@@ -65,29 +67,46 @@
</att.Columns>
<Cell ref.Name="headerContainer" Site="row:0 column:0">
<Bounds ref.Name="headerTable" AlignmentToParent="left:0 top:0 right:0 bottom:0" MinSizeLimitation="LimitToElementAndChildren">
<RepeatFlow ref.Name="header" AlignmentToParent="left:0 top:-1 right:0 bottom:0" ExtraMargin="left:2 top:2 right:2 bottom:0" MinSizeLimitation="LimitToElementAndChildren">
<att.ItemTemplate>sample::TabWindowTabHeaderTemplate</att.ItemTemplate>
<att.ItemSource-bind>self.TabPages</att.ItemSource-bind>
<ev.ItemInserted-eval>
<![CDATA[
{
var flowItem = header.FlowItems[arguments.itemIndex];
var item = cast (TabWindowTabHeaderTemplate*) flowItem.Children[0];
item.Commands = self.Commands;
self.UpdateTabHeader();
}
]]>
</ev.ItemInserted-eval>
<ev.ItemRemoved-eval>
<![CDATA[
{
self.UpdateTabHeader();
}
]]>
</ev.ItemRemoved-eval>
</RepeatFlow>
</Bounds>
<Table ref.Name="headerTable" AlignmentToParent="left:0 top:0 right:0 bottom:0" MinSizeLimitation="LimitToElementAndChildren">
<att.Rows>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
</att.Rows>
<att.Columns>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
</att.Columns>
<Cell Site="row:1 column:0" InternalMargin="left:2 top:0 right:2 bottom:0">
<Button Text="+" ev.Clicked-eval="self.AddPageRequested();">
<att.BoundsComposition-set AssociatedHitTestResult="Client"/>
</Button>
</Cell>
<Cell Site="row:0 column:1 rowSpan:3">
<RepeatFlow ref.Name="header" AlignmentToParent="left:0 top:-1 right:0 bottom:0" ExtraMargin="left:2 top:2 right:2 bottom:0" MinSizeLimitation="LimitToElementAndChildren">
<att.ItemTemplate>sample::TabWindowTabHeaderTemplate</att.ItemTemplate>
<att.ItemSource-bind>self.TabPages</att.ItemSource-bind>
<ev.ItemInserted-eval>
<![CDATA[
{
var flowItem = header.FlowItems[arguments.itemIndex];
var item = cast (TabWindowTabHeaderTemplate*) flowItem.Children[0];
item.Commands = self.Commands;
self.UpdateTabHeader();
}
]]>
</ev.ItemInserted-eval>
<ev.ItemRemoved-eval>
<![CDATA[
{
self.UpdateTabHeader();
}
]]>
</ev.ItemRemoved-eval>
</RepeatFlow>
</Cell>
</Table>
</Cell>
<Cell Site="row:1 column:0">
<SolidBackground Color="#007ACC"/>
@@ -25,13 +25,14 @@
<att.Rows>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
</att.Rows>
<att.Columns>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
<CellOption>composeType:MinSize</CellOption>
</att.Columns>
<Cell Site="row:0 column:0 rowSpan:2">
<Cell Site="row:0 column:0 rowSpan:3">
<SolidLabel Text-bind="self.Text" Font-bind="self.Font" HorizontalAlignment="Center" VerticalAlignment="Center">
<att.Color-bind>
<![CDATA[