MainWindow.xaml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <Window x:Class="wpf_app.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:wpf_app"
  7. mc:Ignorable="d"
  8. Title="Нагеев шоп" Height="450" Width="950">
  9. <Window.Resources>
  10. <BitmapImage
  11. x:Key='defaultImage'
  12. UriSource="./img/defaultPicture.jpg"/>
  13. </Window.Resources>
  14. <Grid ShowGridLines="False">
  15. <Grid.RowDefinitions>
  16. <RowDefinition Height="auto"/>
  17. <RowDefinition />
  18. <RowDefinition Height="auto"/>
  19. </Grid.RowDefinitions>
  20. <Grid.ColumnDefinitions>
  21. <ColumnDefinition Width="200"/>
  22. <ColumnDefinition/>
  23. </Grid.ColumnDefinitions>
  24. <Image
  25. Source="assets/nagievlogo2.jpg"
  26. Grid.Row="0"
  27. Grid.RowSpan="2"
  28. Stretch="Fill"/>
  29. <ListBox
  30. x:Name="productsListBox"
  31. Grid.Row="1"
  32. Grid.Column="1"
  33. Background="White"
  34. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  35. ItemsSource="{Binding ProductList}"
  36. MouseDoubleClick="productsListBox_MouseDoubleClick">
  37. <ListBox.ItemsPanel>
  38. <ItemsPanelTemplate>
  39. <WrapPanel
  40. HorizontalAlignment="Center"/>
  41. </ItemsPanelTemplate>
  42. </ListBox.ItemsPanel>
  43. <ListBox.ItemTemplate>
  44. <DataTemplate>
  45. <Border
  46. BorderThickness="1"
  47. BorderBrush="Black"
  48. CornerRadius="5">
  49. <Grid
  50. Margin="10"
  51. Width="300"
  52. HorizontalAlignment="Stretch">
  53. <Grid.ColumnDefinitions>
  54. <ColumnDefinition Width="64"/>
  55. <ColumnDefinition Width="*"/>
  56. <ColumnDefinition Width="*"/>
  57. </Grid.ColumnDefinitions>
  58. <Image
  59. Width="64"
  60. Height="64"
  61. Source="{Binding ImageBitmap,TargetNullValue={StaticResource defaultImage}}"/>
  62. <StackPanel
  63. Grid.Column="1"
  64. Margin="5"
  65. Orientation="Vertical"
  66. VerticalAlignment="Center">
  67. <TextBlock
  68. Text="{Binding Company}"/>
  69. <TextBlock
  70. Text="{Binding Title}"/>
  71. </StackPanel>
  72. <WrapPanel
  73. Grid.Column="2"
  74. VerticalAlignment="Center"
  75. HorizontalAlignment="Right">
  76. <Label
  77. Content="Цена:"/>
  78. <TextBlock
  79. Grid.Column="2"
  80. HorizontalAlignment="Right"
  81. VerticalAlignment="Center"
  82. Text="{Binding Price}"/>
  83. </WrapPanel>
  84. </Grid>
  85. </Border>
  86. </DataTemplate>
  87. </ListBox.ItemTemplate>
  88. </ListBox>
  89. <StackPanel
  90. Orientation="Vertical"
  91. Grid.RowSpan="3"
  92. Grid.Row="2"
  93. VerticalAlignment="Bottom">
  94. <Button
  95. x:Name="ExitButton"
  96. Content="Выход"
  97. Click="ExitButton_Click"
  98. Height="50"/>
  99. </StackPanel>
  100. <WrapPanel
  101. Orientation="Horizontal"
  102. Grid.Column="1"
  103. MinHeight="50"
  104. Margin="0 5 0 0">
  105. <Label
  106. Content="Категория:"
  107. VerticalAlignment="Center"/>
  108. <ComboBox
  109. Name="CategoryFilterComboBox"
  110. SelectionChanged="CategoryFilterComboBox_SelectionChanged"
  111. VerticalAlignment="Center"
  112. MinWidth="100"
  113. SelectedIndex="0"
  114. ItemsSource="{Binding CategoryList}">
  115. <ComboBox.ItemTemplate>
  116. <DataTemplate>
  117. <Label
  118. Content="{Binding title}"/>
  119. </DataTemplate>
  120. </ComboBox.ItemTemplate>
  121. </ComboBox>
  122. <Label
  123. Content="Цена"/>
  124. <ComboBox
  125. Name ="PriceFilterComboBox"
  126. SelectionChanged="PriceFilterComboBox_SelectionChanged"
  127. VerticalAlignment="Center"
  128. MinWidth="100"
  129. SelectedIndex="0"
  130. ItemsSource="{Binding ProductPrices}">
  131. <ComboBox.ItemTemplate>
  132. <DataTemplate>
  133. <Label
  134. Content="{Binding title}"/>
  135. </DataTemplate>
  136. </ComboBox.ItemTemplate>
  137. </ComboBox>
  138. <Label
  139. Content="Компания"/>
  140. <ComboBox
  141. Name ="CompanyFilterComboBox"
  142. SelectionChanged="CompanyFilterComboBox_SelectionChanged"
  143. VerticalAlignment="Center"
  144. MinWidth="100"
  145. SelectedIndex="0"
  146. ItemsSource="{Binding ProductCompanies}">
  147. <ComboBox.ItemTemplate>
  148. <DataTemplate>
  149. <Label
  150. Content="{Binding title}"/>
  151. </DataTemplate>
  152. </ComboBox.ItemTemplate>
  153. </ComboBox>
  154. <Label
  155. Content="Поиск"
  156. VerticalAlignment="Center"/>
  157. <TextBox
  158. Width="180"
  159. VerticalAlignment="Center"
  160. x:Name="SearchFilterTextBox"
  161. KeyUp="SearchFilterTextBox_KeyUp"/>
  162. <Label
  163. Content="Цена:"
  164. VerticalAlignment="Center"/>
  165. <RadioButton
  166. GroupName="Price"
  167. Tag="1"
  168. Content="по возрастанию"
  169. IsChecked="True"
  170. Checked="RadioButton_Checked"
  171. VerticalAlignment="Center"/>
  172. <RadioButton
  173. GroupName="Price"
  174. Tag="2"
  175. Content="по убыванию"
  176. Checked="RadioButton_Checked"
  177. VerticalAlignment="Center"/>
  178. </WrapPanel>
  179. </Grid>
  180. </Window>