MainWindow.xaml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <Window x:Class="wpf_listbox.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_listbox"
  7. mc:Ignorable="d"
  8. Title="MainWindow" Height="450" Width="880">
  9. <Window.Resources>
  10. <BitmapImage
  11. x:Key='defaultImage'
  12. UriSource='./img/1.webp' />
  13. </Window.Resources>
  14. <Grid ShowGridLines="True">
  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. <!-- типа логотип компании -->
  25. <Image
  26. Source="./img/1.webp"
  27. Grid.RowSpan="2" HorizontalAlignment="Right"/>
  28. <ListBox
  29. Grid.Column="1"
  30. Grid.Row="1"
  31. Background="White"
  32. ItemsSource="{Binding PeopleList}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
  33. <ListBox.ItemsPanel>
  34. <ItemsPanelTemplate>
  35. <WrapPanel
  36. HorizontalAlignment="Center" />
  37. </ItemsPanelTemplate>
  38. </ListBox.ItemsPanel>
  39. <ListBox.ItemTemplate>
  40. <DataTemplate>
  41. <Border
  42. BorderThickness="1"
  43. BorderBrush="Black"
  44. CornerRadius="5">
  45. <Grid Width="200"
  46. Margin="10"
  47. HorizontalAlignment="Stretch">
  48. <Grid.ColumnDefinitions>
  49. <ColumnDefinition Width="64"/>
  50. <ColumnDefinition Width="*"/>
  51. <ColumnDefinition Width="auto"/>
  52. </Grid.ColumnDefinitions>
  53. <Image
  54. Width="64"
  55. Height="64"
  56. Source="{Binding ImageBitmap,TargetNullValue={StaticResource defaultImage}}" />
  57. <StackPanel
  58. Grid.Column="1"
  59. Margin="5"
  60. Orientation="Vertical">
  61. <TextBlock
  62. Text="{Binding Name}"/>
  63. <TextBlock
  64. Text="{Binding Price}"/>
  65. <TextBlock
  66. Text="{Binding Place}"/>
  67. </StackPanel>
  68. <TextBlock
  69. Grid.Column="2"
  70. Text="{Binding Age}"/>
  71. </Grid>
  72. </Border>
  73. </DataTemplate>
  74. </ListBox.ItemTemplate>
  75. </ListBox>
  76. <StackPanel
  77. Orientation="Vertical"
  78. Grid.RowSpan="3"
  79. VerticalAlignment="Bottom">
  80. <Button
  81. x:Name="ExitButton"
  82. Content="Выход"
  83. Click="ExitButton_Click"
  84. Height="50"/>
  85. </StackPanel>
  86. <WrapPanel
  87. Orientation="Horizontal"
  88. Grid.Column="1"
  89. MinHeight="50">
  90. <Label
  91. Content="искать"
  92. VerticalAlignment="Center"/>
  93. <TextBox
  94. Width="200"
  95. VerticalAlignment="Center"
  96. x:Name="SearchFilterTextBox"
  97. KeyUp="SearchFilter_KeyUp"/>
  98. <ComboBox
  99. Name="GenderFilterComboBox"
  100. SelectionChanged="GenderFilterComboBox_SelectionChanged_1"
  101. VerticalAlignment="Center"
  102. MinWidth="100"
  103. SelectedIndex="0"
  104. ItemsSource="{Binding PeopleGenderList}">
  105. <ComboBox.ItemTemplate>
  106. <DataTemplate>
  107. <Label
  108. Content="{Binding title}"/>
  109. </DataTemplate>
  110. </ComboBox.ItemTemplate>
  111. </ComboBox>
  112. <Label
  113. Content="Возраст:"
  114. VerticalAlignment="Center"/>
  115. <ComboBox
  116. Name="AgeFilterComboBox"
  117. SelectionChanged="AgeFilterComboBox_SelectionChanged_2"
  118. VerticalAlignment="Center"
  119. MinWidth="100"
  120. SelectedIndex="0"
  121. ItemsSource="{Binding PeopleAgeList}">
  122. <ComboBox.ItemTemplate>
  123. <DataTemplate>
  124. <Label
  125. Content="{Binding title}"/>
  126. </DataTemplate>
  127. </ComboBox.ItemTemplate>
  128. </ComboBox>
  129. <Label
  130. Content="Место:"
  131. VerticalAlignment="Center"/>
  132. <ComboBox
  133. Name="PlaceFilterComboBox"
  134. SelectionChanged="PlaceFilterComboBox_SelectionChanged_3"
  135. VerticalAlignment="Center"
  136. MinWidth="100"
  137. SelectedIndex="0"
  138. ItemsSource="{Binding PeoplePlaceList}">
  139. <ComboBox.ItemTemplate>
  140. <DataTemplate>
  141. <Label
  142. Content="{Binding title}"/>
  143. </DataTemplate>
  144. </ComboBox.ItemTemplate>
  145. </ComboBox>
  146. <Label
  147. Content="Цена:"
  148. VerticalAlignment="Center"/>
  149. <RadioButton
  150. GroupName="Price"
  151. Tag="1"
  152. Content="Сначала недорогие"
  153. IsChecked="True"
  154. Checked="RadioButton_Checked"
  155. VerticalAlignment="Center"/>
  156. <RadioButton
  157. GroupName="Price"
  158. Tag="2"
  159. Content="Сначала дорогие"
  160. Checked="RadioButton_Checked"
  161. VerticalAlignment="Center"/>
  162. <!-- минимальную высоту я тут поставил, чтобы верхнюю строку сетки было видно. В реальном приложении она не нужна -->
  163. </WrapPanel>
  164. </Grid>
  165. </Window>