MainWindow.xaml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <Window x:Class="WpfApp1.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:WpfApp1"
  7. mc:Ignorable="d"
  8. Title="Иванов Валера И-211" Height="450" Width="908">
  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. <Style
  36. TargetType="Button">
  37. <Setter
  38. Property="FontFamily"
  39. Value="Verdana" />
  40. <Setter
  41. Property="Background"
  42. Value="Black" />
  43. <Setter
  44. Property="Foreground"
  45. Value="White" />
  46. <Setter
  47. Property="Margin"
  48. Value="10" />
  49. </Style>
  50. </Window.Resources>
  51. <Grid ShowGridLines="True">
  52. <Grid.RowDefinitions>
  53. <RowDefinition Height="auto"/>
  54. <RowDefinition />
  55. <RowDefinition Height="auto"/>
  56. </Grid.RowDefinitions>
  57. <Grid.ColumnDefinitions>
  58. <ColumnDefinition Width="200"/>
  59. <ColumnDefinition/>
  60. </Grid.ColumnDefinitions>
  61. <!-- лого -->
  62. <Image
  63. Source="./bin/Debug/net8.0-windows/img/net.jpg"
  64. Grid.RowSpan="2" HorizontalAlignment="Right"/>
  65. <ListBox
  66. MouseDoubleClick="carListBox_MouseDoubleClick"
  67. x:Name="carListBox"
  68. Style="{StaticResource StackStyle}"
  69. Grid.Row="1"
  70. Grid.Column="1"
  71. Background="White"
  72. ItemsSource="{Binding CarList}"
  73. ScrollViewer.HorizontalScrollBarVisibility="Disabled">
  74. <ListBox.ItemContainerStyle>
  75. <Style
  76. TargetType="ListBoxItem">
  77. <Setter
  78. Property="HorizontalContentAlignment"
  79. Value="Stretch" />
  80. </Style>
  81. </ListBox.ItemContainerStyle>
  82. <ListBox.ItemTemplate>
  83. <DataTemplate>
  84. <Border
  85. BorderThickness="1"
  86. BorderBrush="Black"
  87. CornerRadius="5">
  88. <Grid
  89. Margin="10"
  90. HorizontalAlignment="Stretch">
  91. <Grid.ColumnDefinitions>
  92. <ColumnDefinition Width="64"/>
  93. <ColumnDefinition Width="*"/>
  94. <ColumnDefinition Width="auto"/>
  95. </Grid.ColumnDefinitions>
  96. <Image
  97. Width="64"
  98. Height="64"
  99. Source="{Binding ImageBitmap}" />
  100. <StackPanel
  101. Grid.Column="1"
  102. Margin="5"
  103. Orientation="Vertical">
  104. <TextBlock
  105. Text="{Binding name}"/>
  106. <TextBlock
  107. Text="{Binding price}"/>
  108. </StackPanel>
  109. <TextBlock
  110. Grid.Column="2"
  111. Text="{Binding year}"/>
  112. </Grid>
  113. </Border>
  114. </DataTemplate>
  115. </ListBox.ItemTemplate>
  116. </ListBox>
  117. <StackPanel
  118. Orientation="Vertical"
  119. Grid.RowSpan="3"
  120. VerticalAlignment="Bottom">
  121. <Button
  122. Background="LightSeaGreen"
  123. x:Name="ExitButton"
  124. Content="Выход"
  125. Click="ExitButton_Click"
  126. Height="50"/>
  127. </StackPanel>
  128. <WrapPanel
  129. Orientation="Horizontal"
  130. Grid.Column="1"
  131. MinHeight="50">
  132. <Button Content="Переключить вид" Click="ToggleView_Click"/>
  133. <Label
  134. Content="Поиск"
  135. VerticalAlignment="Center"/>
  136. <TextBox
  137. Width="200"
  138. VerticalAlignment="Center"
  139. x:Name="SearchFilterTextBox"
  140. KeyUp="SearchFilter_KeyUp"/>
  141. <Label
  142. Content="Название:"
  143. VerticalAlignment="Center"/>
  144. <ComboBox
  145. Name="carnameFilterComboBox"
  146. SelectionChanged="carnameFilterComboBox_SelectionChanged"
  147. VerticalAlignment="Center"
  148. MinWidth="100"
  149. SelectedIndex="0"
  150. ItemsSource="{Binding CarinfoList}">
  151. <ComboBox.ItemTemplate>
  152. <DataTemplate>
  153. <Label
  154. Content="{Binding title}"/>
  155. </DataTemplate>
  156. </ComboBox.ItemTemplate>
  157. </ComboBox>
  158. <Label
  159. Content="Цена:"
  160. VerticalAlignment="Center"/>
  161. <ComboBox
  162. Name="carpriceFilterComboBox"
  163. SelectionChanged="carpriceFilterComboBox_SelectionChanged"
  164. VerticalAlignment="Center"
  165. MinWidth="100"
  166. SelectedIndex="0"
  167. ItemsSource="{Binding CarpriceList}">
  168. <ComboBox.ItemTemplate>
  169. <DataTemplate>
  170. <Label
  171. Content="{Binding title}"/>
  172. </DataTemplate>
  173. </ComboBox.ItemTemplate>
  174. </ComboBox>
  175. <Label
  176. Content="Возраст:"
  177. VerticalAlignment="Center"/>
  178. <RadioButton
  179. GroupName="Age"
  180. Tag="1"
  181. Content="по возрастанию"
  182. IsChecked="True"
  183. Checked="RadioButton_Checked"
  184. VerticalAlignment="Center"/>
  185. <RadioButton
  186. GroupName="Age"
  187. Tag="2"
  188. Content="по убыванию"
  189. Checked="RadioButton_Checked"
  190. VerticalAlignment="Center"/>
  191. </WrapPanel>
  192. </Grid>
  193. </Window>