MainWindow.xaml 7.0 KB

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