-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml
60 lines (57 loc) · 2.53 KB
/
MainWindow.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
58
59
60
<Window x:Class="MVVM.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:MVVM"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Style TargetType="TextBlock">
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="TextBox">
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="Button">
<Setter Property="Width" Value="40"/>
<Setter Property="Margin" Value="5"/>
</Style>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.8*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="0.2*"/>
</Grid.RowDefinitions>
<ListBox Grid.Column="0" ItemsSource="{Binding Phones}"
SelectedItem="{Binding SelectedPhone}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="5">
<TextBlock FontSize="18" Text="{Binding Path=Title}"/>
<TextBlock Text="{Binding Path=Company}"/>
<TextBlock Text="{Binding Path=Price}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Button Command="{Binding AddCommand}">+</Button>
<Button Command="{Binding RemoveCommand}"
CommandParameter="{Binding SelectedPhone}">-</Button>
</StackPanel>
<StackPanel Grid.Column="1" DataContext="{Binding SelectedPhone}">
<TextBlock Text="Выбранный элемент"/>
<TextBlock Text="Модель"/>
<TextBox Text="{Binding Title, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="Производитель"/>
<TextBox Text="{Binding Company, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="Цена"/>
<TextBox Text="{Binding Price, UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
</Grid>
</Window>