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; var tct = cast (TabWindowTabTemplate*) tab.ControlTemplateObject;
tct.SetTabHeaderContainer(wct.TabHeaderContainer); tct.SetTabHeaderContainer(wct.TabHeaderContainer);
tab.Pages.Add(new LoremIpsumTabPage*()); attach(tct.AddPageRequested, func():void
tab.Pages.Add(new LoremIpsumTabPage*()); {
var tabPage = new LoremIpsumTabPage*();
tab.Pages.Insert(0, tabPage);
tab.SelectedPage = tabPage;
});
tab.Pages.Add(new LoremIpsumTabPage*()); tab.Pages.Add(new LoremIpsumTabPage*());
} }
]]></ref.Ctor> ]]></ref.Ctor>
@@ -42,6 +42,8 @@
headerContainer.AddChild(headerTable); headerContainer.AddChild(headerTable);
} }
} }
event AddPageRequested();
]]> ]]>
</ref.Members> </ref.Members>
<TabTemplate ref.Name="self" ContainerComposition-ref="container" TabOrder="LeftToRight" MinSizeLimitation="LimitToElementAndChildren"> <TabTemplate ref.Name="self" ContainerComposition-ref="container" TabOrder="LeftToRight" MinSizeLimitation="LimitToElementAndChildren">
@@ -65,29 +67,46 @@
</att.Columns> </att.Columns>
<Cell ref.Name="headerContainer" Site="row:0 column:0"> <Cell ref.Name="headerContainer" Site="row:0 column:0">
<Bounds ref.Name="headerTable" AlignmentToParent="left:0 top:0 right:0 bottom:0" MinSizeLimitation="LimitToElementAndChildren"> <Table 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.Rows>
<att.ItemTemplate>sample::TabWindowTabHeaderTemplate</att.ItemTemplate> <CellOption>composeType:Percentage percentage:1.0</CellOption>
<att.ItemSource-bind>self.TabPages</att.ItemSource-bind> <CellOption>composeType:MinSize</CellOption>
<ev.ItemInserted-eval> <CellOption>composeType:Percentage percentage:1.0</CellOption>
<![CDATA[ </att.Rows>
{ <att.Columns>
var flowItem = header.FlowItems[arguments.itemIndex]; <CellOption>composeType:MinSize</CellOption>
var item = cast (TabWindowTabHeaderTemplate*) flowItem.Children[0]; <CellOption>composeType:Percentage percentage:1.0</CellOption>
item.Commands = self.Commands; </att.Columns>
self.UpdateTabHeader();
} <Cell Site="row:1 column:0" InternalMargin="left:2 top:0 right:2 bottom:0">
]]> <Button Text="+" ev.Clicked-eval="self.AddPageRequested();">
</ev.ItemInserted-eval> <att.BoundsComposition-set AssociatedHitTestResult="Client"/>
<ev.ItemRemoved-eval> </Button>
<![CDATA[ </Cell>
{ <Cell Site="row:0 column:1 rowSpan:3">
self.UpdateTabHeader(); <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.ItemRemoved-eval> <ev.ItemInserted-eval>
</RepeatFlow> <![CDATA[
</Bounds> {
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>
<Cell Site="row:1 column:0"> <Cell Site="row:1 column:0">
<SolidBackground Color="#007ACC"/> <SolidBackground Color="#007ACC"/>
@@ -25,13 +25,14 @@
<att.Rows> <att.Rows>
<CellOption>composeType:Percentage percentage:1.0</CellOption> <CellOption>composeType:Percentage percentage:1.0</CellOption>
<CellOption>composeType:MinSize</CellOption> <CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
</att.Rows> </att.Rows>
<att.Columns> <att.Columns>
<CellOption>composeType:Percentage percentage:1.0</CellOption> <CellOption>composeType:Percentage percentage:1.0</CellOption>
<CellOption>composeType:MinSize</CellOption> <CellOption>composeType:MinSize</CellOption>
</att.Columns> </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"> <SolidLabel Text-bind="self.Text" Font-bind="self.Font" HorizontalAlignment="Center" VerticalAlignment="Center">
<att.Color-bind> <att.Color-bind>
<![CDATA[ <![CDATA[