-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
144 lines (137 loc) · 5.68 KB
/
Copy pathMainWindow.xaml
File metadata and controls
144 lines (137 loc) · 5.68 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<mah:MetroWindow x:Class="WpfCommands.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:WpfCommands.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WpfCommands.MVVM.ViewModel"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:model="clr-namespace:WpfCommands.MVVM.Model"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="{Binding Title}"
Width="800"
Height="450"
Background="{Binding AppBackground}"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Window.DataContext>
<local:MainViewModel />
</Window.DataContext>
<Window.Resources>
<converters:AppConverters x:Key="appconverters" />
</Window.Resources>
<Grid x:Name="gridtitle" Background="{Binding AppBackground}">
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="175*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0"
Grid.ColumnSpan="5"
Width="{Binding Width}"
Height="Auto"
Margin="5,0,25,0"
Background="{Binding AppBackground}"
Foreground="White"
Text="{Binding Title, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" />
<Button Grid.Row="1"
Grid.Column="0"
Width="125"
Margin="15,18,20,385"
Background="{Binding ButtonBackground}"
Command="{Binding ViewModelBase.ClickCommand}">
Click
</Button>
<Button Grid.Row="1"
Grid.Column="0"
Width="125"
Margin="15,45,20,360"
Background="{Binding ButtonBackground}"
Command="{Binding ViewModelBase.ClickCommand2}"
Content="Click2" />
<Button Grid.Row="1"
Grid.Column="0"
Width="125"
Margin="15,70,20,335"
Background="{Binding ButtonBackground}"
Command="{Binding ViewModelBase.SaveCommand}"
Content="Save">
<Button.CommandParameter>
<MultiBinding Converter="{StaticResource ResourceKey=appconverters}">
<Binding ElementName="namentxt" Path="Text" />
<Binding ElementName="vornametxt" Path="Text" />
<Binding ElementName="agetext" Path="Text" />
<Binding ElementName="cmbxcountries" Path="Text" />
</MultiBinding>
</Button.CommandParameter>
</Button>
<Button Grid.Row="1"
Grid.Column="1"
Width="125"
Margin="20,20,15,383"
Background="{Binding ButtonBackground}"
Command="{Binding ViewModelBase.TestCommand}">
Click Test
</Button>
<TextBox x:Name="namentxt"
Grid.Row="1"
Grid.Column="0"
Margin="15,100,20,305"
Text="{Binding SaveModel.Name, Mode=TwoWay}" />
<TextBox x:Name="vornametxt"
Grid.Row="1"
Grid.Column="0"
Margin="15,130,20,275"
Text="{Binding SaveModel.Vorname, Mode=TwoWay}" />
<TextBox x:Name="agetext"
Grid.Row="1"
Grid.Column="0"
Margin="15,160,20,245"
PreviewTextInput="agetext_PreviewTextInput"
Text="{Binding SaveModel.Age, Mode=TwoWay}" />
<ComboBox x:Name="cmbxcountries"
Grid.Row="1"
Grid.Column="0"
Margin="15,190,20,215"
IsEnabled="True"
IsReadOnly="False"
IsTextSearchEnabled="True"
Text="{Binding SaveModel.Country, Mode=TwoWay}">
<ComboBoxItem>
DE
</ComboBoxItem>
<ComboBoxItem>
EN
</ComboBoxItem>
<ComboBoxItem>
US
</ComboBoxItem>
<ComboBoxItem>
RU
</ComboBoxItem>
</ComboBox>
<GroupBox Grid.RowSpan="10"
Grid.Column="2"
Margin="5"
Header="Tims Proposal">
<GroupBox.DataContext>
<local:TimsViewModel />
</GroupBox.DataContext>
<StackPanel>
<TextBlock>Enter your Name:</TextBlock>
<TextBox Margin="5" Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock>Enter your Age:</TextBlock>
<mah:NumericUpDown Margin="5" Value="{Binding Age, UpdateSourceTrigger=PropertyChanged}" />
<Button Margin="5"
Command="{Binding GreetMeCommand}"
CommandParameter="{Binding Name, ValidatesOnNotifyDataErrors=False}"
Content="Greet Me" />
</StackPanel>
</GroupBox>
</Grid>
</mah:MetroWindow>