-
Notifications
You must be signed in to change notification settings - Fork 20
/
ViewModelPage.xaml
57 lines (50 loc) · 2.32 KB
/
ViewModelPage.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<UserControl
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:fxui="clr-namespace:SilverlightFX.UserInterface;assembly=SilverlightFX"
xmlns:fxactions="clr-namespace:SilverlightFX.UserInterface.Actions;assembly=SilverlightFX"
xmlns:app="clr-namespace:Experiments;assembly=Experiments"
x:Class="Experiments.ViewModelPage">
<UserControl.DataContext>
<app:NumberModel />
</UserControl.DataContext>
<StackPanel Background="White" Margin="20" HorizontalAlignment="Center">
<StackPanel Orientation="Horizontal">
<fxui:XTextBox x:Name="valueTextBox" Width="40" Height="21" />
<fxui:XButton Margin="2" Width="75" Height="23" VerticalAlignment="Center"
Content="Initialize">
<fxui:Interaction.Triggers>
<fxui:ClickTrigger>
<fxactions:SetProperty PropertyName="Value" ValueBinding="{Binding ElementName=valueTextBox, Path=Text}" />
</fxui:ClickTrigger>
</fxui:Interaction.Triggers>
</fxui:XButton>
</StackPanel>
<StackPanel Orientation="Horizontal">
<fxui:XTextBox x:Name="numberTextBox" Width="40" Height="21" />
<Button Content="Add" Margin="2" fxui:Interaction.Action="$dataContext.Add(numberTextBox.Text)" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource flatLabel}" VerticalAlignment="Center"
FontWeight="Bold" Margin="20,0,20,0"
Text="{Binding Value}" />
<fxui:XButton Margin="2" Width="75" Height="23" VerticalAlignment="Center"
Content="Increment">
<fxui:Interaction.Triggers>
<fxui:ClickTrigger>
<fxactions:InvokeMethod MethodName="Increment" />
<fxactions:InvokeMethod MethodName="Increment" Condition="{Binding IsSingleDigit}" />
</fxui:ClickTrigger>
</fxui:Interaction.Triggers>
</fxui:XButton>
<fxui:XButton Margin="2" Width="75" Height="23" VerticalAlignment="Center"
Content="Decrement" IsEnabled="{Binding CanDecrement}">
<fxui:Interaction.Triggers>
<fxui:ClickTrigger>
<fxactions:InvokeMethod MethodName="Decrement" />
</fxui:ClickTrigger>
</fxui:Interaction.Triggers>
</fxui:XButton>
</StackPanel>
</StackPanel>
</UserControl>