MainWindow.xaml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <Window x:Class="WpfApp2.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:local="clr-namespace:WpfApp2"
  7. mc:Ignorable="d"
  8. Title="MainWindow" Height="450" Width="800">
  9. <Window.Resources>
  10. <Style
  11. x:Key="StackStyle"
  12. TargetType="ListBox">
  13. <Setter Property="ItemsPanel">
  14. <Setter.Value>
  15. <ItemsPanelTemplate>
  16. <StackPanel
  17. Orientation="Vertical"/>
  18. </ItemsPanelTemplate>
  19. </Setter.Value>
  20. </Setter>
  21. </Style>
  22. <Style
  23. x:Key="WrapStyle"
  24. TargetType="ListBox">
  25. <Setter Property="ItemsPanel">
  26. <Setter.Value>
  27. <ItemsPanelTemplate>
  28. <WrapPanel
  29. HorizontalAlignment="Center"
  30. ItemWidth="200"/>
  31. </ItemsPanelTemplate>
  32. </Setter.Value>
  33. </Setter>
  34. </Style>
  35. <BitmapImage
  36. x:Key='defaultImage'
  37. UriSource='/img/1.jpg' />
  38. </Window.Resources>
  39. <Grid ShowGridLines="True">
  40. <Grid.RowDefinitions>
  41. <RowDefinition Height="auto"/>
  42. <RowDefinition />
  43. <RowDefinition Height="auto"/>
  44. </Grid.RowDefinitions>
  45. <Grid.ColumnDefinitions>
  46. <ColumnDefinition Width="200"/>
  47. <ColumnDefinition/>
  48. </Grid.ColumnDefinitions>
  49. <!-- типа логотип компании -->
  50. <Image
  51. Source="./img/1.jpg"
  52. Grid.RowSpan="2" HorizontalAlignment="Right"/>
  53. <ListBox
  54. Grid.Column="1"
  55. Grid.Row="1"
  56. Background="White"
  57. ItemsSource="{Binding ClientList}" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  58. MouseDoubleClick="ClientListBox_MouseDoubleClick"
  59. x:Name="ClientListBox">
  60. <ListBox.ItemsPanel>
  61. <ItemsPanelTemplate>
  62. <WrapPanel
  63. HorizontalAlignment="Center" />
  64. </ItemsPanelTemplate>
  65. </ListBox.ItemsPanel>
  66. <ListBox.ItemTemplate>
  67. <DataTemplate>
  68. <Border
  69. BorderThickness="1"
  70. BorderBrush="Black"
  71. CornerRadius="5">
  72. <Grid
  73. Width="200"
  74. Margin="10"
  75. HorizontalAlignment="Stretch">
  76. <Grid.ColumnDefinitions>
  77. <ColumnDefinition Width="64"/>
  78. <ColumnDefinition Width="*"/>
  79. <ColumnDefinition Width="auto"/>
  80. </Grid.ColumnDefinitions>
  81. <Image
  82. Width="64"
  83. Height="64"
  84. Source="{Binding ImageBitmap}" />
  85. <StackPanel
  86. Grid.Column="1"
  87. Margin="5"
  88. Orientation="Vertical">
  89. <TextBlock
  90. Text="{Binding Name}"/>
  91. <TextBlock
  92. Text="{Binding Place}"/>
  93. </StackPanel>
  94. <TextBlock
  95. Grid.Column="2"
  96. Text="{Binding Price}"/>
  97. </Grid>
  98. </Border>
  99. </DataTemplate>
  100. </ListBox.ItemTemplate>
  101. </ListBox>
  102. <StackPanel
  103. Orientation="Vertical"
  104. Grid.RowSpan="3"
  105. VerticalAlignment="Bottom">
  106. <Button
  107. x:Name="ExitButton"
  108. Content="Выход"
  109. Click="ExitButton_Click"
  110. Height="50"/>
  111. </StackPanel>
  112. <WrapPanel
  113. Orientation="Horizontal"
  114. Grid.Column="1"
  115. MinHeight="50">
  116. <Label
  117. Content="Искать:"
  118. VerticalAlignment="Center"/>
  119. <TextBox
  120. Width="200"
  121. VerticalAlignment="Center"
  122. x:Name="SearchFilterTextBox"
  123. KeyUp="SearchFilter_KeyUp"/>
  124. <ComboBox
  125. Name="CategoryFilterComboBox"
  126. SelectionChanged="ClientCategoryFilterComboBox_selectionChanged"
  127. VerticalAlignment="Center"
  128. MinWidth="100"
  129. SelectedIndex="0"
  130. ItemsSource="{Binding ClientCategoryList}">
  131. <ComboBox.ItemTemplate>
  132. <DataTemplate>
  133. <Label
  134. Content="{Binding title}"/>
  135. </DataTemplate>
  136. </ComboBox.ItemTemplate>
  137. </ComboBox>
  138. <Label
  139. Content="Цена:"
  140. VerticalAlignment="Center"/>
  141. <ComboBox
  142. Name="PriceFilterComboBox"
  143. SelectionChanged="ClientPriceFilterComboBox_selectionChanged"
  144. VerticalAlignment="Center"
  145. MinWidth="100"
  146. SelectedIndex="0"
  147. ItemsSource="{Binding ClientPriceList}">
  148. <ComboBox.ItemTemplate>
  149. <DataTemplate>
  150. <Label
  151. Content="{Binding title}"/>
  152. </DataTemplate>
  153. </ComboBox.ItemTemplate>
  154. </ComboBox>
  155. <Label
  156. Content="Возраст:"
  157. VerticalAlignment="Center"/>
  158. <RadioButton
  159. GroupName="Age"
  160. Tag="1"
  161. Content="Сначала взрослые"
  162. IsChecked="True"
  163. Checked="RadioButton_Checked"
  164. VerticalAlignment="Center"/>
  165. <RadioButton
  166. GroupName="Age"
  167. Tag="2"
  168. Content="Сначала дети"
  169. Checked="RadioButton_Checked"
  170. VerticalAlignment="Center"/>
  171. <!-- минимальную высоту я тут поставил, чтобы верхнюю строку сетки было видно. В реальном приложении она не нужна -->
  172. </WrapPanel>
  173. </Grid>
  174. </Window>