Demo: GacUI_Xml\Binding_(Eval|Bind|Binding)

This commit is contained in:
vczh
2016-04-14 00:22:33 -07:00
parent 50b2a095c5
commit d2e5c3926f
8 changed files with 80 additions and 7 deletions
@@ -17,9 +17,47 @@
<Instance ref.CodeBehind="false" ref.Class="demo::MainWindow">
<Window Text="Binding_Bind" ClientSize="x:480 y:320">
<att.BoundsComposition-set PreferredMinSize="x:480 y:320"/>
<Label Text="This is a window!">
<att.Font>fontFamily:{Segoe UI} size:32 antialias:true</att.Font>
</Label>
<Table CellPadding="5" MinSizeLimitation="LimitToElementAndChildren" AlignmentToParent="left:0 top:0 right:0 bottom:0">
<att.Rows>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
</att.Rows>
<att.Columns>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:Absolute absolute:100</CellOption>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
</att.Columns>
<Cell Site="row:0 column:0" InternalMargin="left:0 top:5 right:0 bottom:5">
<Label Text="A : "/>
</Cell>
<Cell Site="row:0 column:1">
<SinglelineTextBox ref.Name="textBoxA" Text="1">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0" PreferredMinSize="y:24"/>
</SinglelineTextBox>
</Cell>
<Cell Site="row:1 column:0" InternalMargin="left:0 top:5 right:0 bottom:5">
<Label Text="B : "/>
</Cell>
<Cell Site="row:1 column:1">
<SinglelineTextBox ref.Name="textBoxB" Text="2">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0" PreferredMinSize="y:24"/>
</SinglelineTextBox>
</Cell>
<Cell Site="row:2 column:0" InternalMargin="left:0 top:5 right:0 bottom:5">
<Label Text="A + B = : "/>
</Cell>
<Cell Site="row:2 column:1">
<SinglelineTextBox ref.Name="textBoxC" Readonly="true" Text-bind="(cast int textBoxA.Text) + (cast int textBoxB.Text) ?? 'ERROR'">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0" PreferredMinSize="y:24"/>
</SinglelineTextBox>
</Cell>
</Table>
</Window>
</Instance>
</Instance>
@@ -23,11 +23,17 @@ namespace demo
friend struct vl::reflection::description::CustomTypeDescriptorSelector<TImpl>;
private:
protected:
vl::presentation::controls::GuiSinglelineTextBox* textBoxA;
vl::presentation::controls::GuiSinglelineTextBox* textBoxB;
vl::presentation::controls::GuiSinglelineTextBox* textBoxC;
void InitializeComponents()
{
if (InitializeFromResource())
{
GUI_INSTANCE_REFERENCE(textBoxA);
GUI_INSTANCE_REFERENCE(textBoxB);
GUI_INSTANCE_REFERENCE(textBoxC);
}
else
{
@@ -37,6 +43,9 @@ namespace demo
MainWindow_()
:vl::presentation::GuiInstancePartialClass<vl::presentation::controls::GuiWindow>(L"demo::MainWindow")
,vl::presentation::controls::GuiWindow(vl::presentation::theme::GetCurrentTheme()->CreateWindowStyle())
,textBoxA(0)
,textBoxB(0)
,textBoxC(0)
{
}
};
@@ -17,7 +17,7 @@
<Instance ref.CodeBehind="false" ref.Class="demo::MainWindow">
<Window Text="Binding_Eval" ClientSize="x:480 y:320">
<att.BoundsComposition-set PreferredMinSize="x:480 y:320"/>
<Label Text="This is a window!">
<Label Text-eval="'1+2+3+4+5+6+7+8+9+10 = ' &amp; (1+2+3+4+5+6+7+8+9+10)">
<att.Font>fontFamily:{Segoe UI} size:32 antialias:true</att.Font>
</Label>
</Window>
@@ -17,9 +17,32 @@
<Instance ref.CodeBehind="false" ref.Class="demo::MainWindow">
<Window Text="Binding_Format" ClientSize="x:480 y:320">
<att.BoundsComposition-set PreferredMinSize="x:480 y:320"/>
<Label Text="This is a window!">
<att.Font>fontFamily:{Segoe UI} size:32 antialias:true</att.Font>
</Label>
<Table CellPadding="5" MinSizeLimitation="LimitToElementAndChildren" AlignmentToParent="left:0 top:0 right:0 bottom:0">
<att.Rows>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
</att.Rows>
<att.Columns>
<CellOption>composeType:MinSize</CellOption>
<CellOption>composeType:Absolute absolute:100</CellOption>
<CellOption>composeType:Percentage percentage:1.0</CellOption>
</att.Columns>
<Cell Site="row:0 column:0" InternalMargin="left:0 top:5 right:0 bottom:5">
<Label Text="Type your name : "/>
</Cell>
<Cell Site="row:0 column:1">
<SinglelineTextBox ref.Name="textBoxName" Text="Jack">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0" PreferredMinSize="y:24"/>
</SinglelineTextBox>
</Cell>
<Cell Site="row:1 column:0 columnSpan:2" InternalMargin="left:0 top:5 right:0 bottom:5">
<Label Text-format="Hi, $(textBoxName.Text)! How are you?"/>
</Cell>
</Table>
</Window>
</Instance>
</Instance>
@@ -23,11 +23,13 @@ namespace demo
friend struct vl::reflection::description::CustomTypeDescriptorSelector<TImpl>;
private:
protected:
vl::presentation::controls::GuiSinglelineTextBox* textBoxName;
void InitializeComponents()
{
if (InitializeFromResource())
{
GUI_INSTANCE_REFERENCE(textBoxName);
}
else
{
@@ -37,6 +39,7 @@ namespace demo
MainWindow_()
:vl::presentation::GuiInstancePartialClass<vl::presentation::controls::GuiWindow>(L"demo::MainWindow")
,vl::presentation::controls::GuiWindow(vl::presentation::theme::GetCurrentTheme()->CreateWindowStyle())
,textBoxName(0)
{
}
};
Binary file not shown.
Binary file not shown.
Binary file not shown.