MainWindow.xaml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <Window x:Class="WpfAppA.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:WpfAppA"
  7. mc:Ignorable="d"
  8. Title="MainWindow" Height="450" Width="740">
  9. <Window.Resources>
  10. <BitmapImage
  11. x:Key='defaultImage'
  12. UriSource='./img/2.jpg' />
  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/portrait.jpg"
  27. Grid.RowSpan="2" HorizontalAlignment="Right"/>
  28. <ListBox
  29. Grid.Column="1"
  30. Grid.Row="1"
  31. Background="White"
  32. ItemsSource="{Binding HeroList}" 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
  46. Width="200"
  47. Margin="10"
  48. HorizontalAlignment="Stretch">
  49. <Grid.ColumnDefinitions>
  50. <ColumnDefinition Width="64"/>
  51. <ColumnDefinition Width="*"/>
  52. <ColumnDefinition Width="auto"/>
  53. </Grid.ColumnDefinitions>
  54. <!-- сюда потом вставить колонки -->
  55. <StackPanel
  56. Grid.Column="1"
  57. Margin="5"
  58. Orientation="Vertical">
  59. <TextBlock
  60. Text="{Binding name}"/>
  61. <TextBlock
  62. Text="{Binding race}"/>
  63. <TextBlock
  64. Grid.Column="2"
  65. Text="{Binding Age}"/>
  66. </StackPanel>
  67. <Image
  68. Width="64"
  69. Height="64"
  70. Source="{Binding ImageBitmap,TargetNullValue={StaticResource defaultImage}}" />
  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. <RadioButton
  94. GroupName="Age"
  95. Tag="1"
  96. Content="по возрастанию"
  97. IsChecked="True"
  98. Checked="RadioButton_Checked"
  99. VerticalAlignment="Center"/>
  100. <RadioButton
  101. GroupName="Age"
  102. Tag="2"
  103. Content="по убыванию "
  104. Checked="RadioButton_Checked"
  105. VerticalAlignment="Center"/>
  106. <Label
  107. Content="Искать:"
  108. VerticalAlignment="Center"/>
  109. <TextBox
  110. Width="200"
  111. VerticalAlignment="Center"
  112. x:Name="SearchFilterTextBox"
  113. KeyUp="SearchFilter_KeyUp"/>
  114. <Label
  115. Content="Мощь:"
  116. VerticalAlignment="Center"/>
  117. <ComboBox
  118. Name="powerFilterComboBox"
  119. SelectionChanged="powerFilterComboBox_SelectionChanged_1"
  120. VerticalAlignment="Center"
  121. MinWidth="100"
  122. SelectedIndex="0"
  123. ItemsSource="{Binding HeroPowerList}">
  124. <ComboBox.ItemTemplate>
  125. <DataTemplate>
  126. <Label
  127. Content="{Binding title}"/>
  128. </DataTemplate>
  129. </ComboBox.ItemTemplate>
  130. </ComboBox>
  131. <Label
  132. Content="Возраст:"
  133. VerticalAlignment="Center"/>
  134. <ComboBox
  135. Name="AgeFilterComboBox"
  136. SelectionChanged="AgeFilterComboBox_SelectionChanged_2"
  137. VerticalAlignment="Center"
  138. MinWidth="100"
  139. SelectedIndex="0"
  140. ItemsSource="{Binding HeroAgeList}">
  141. <ComboBox.ItemTemplate>
  142. <DataTemplate>
  143. <Label
  144. Content="{Binding title}"/>
  145. </DataTemplate>
  146. </ComboBox.ItemTemplate>
  147. </ComboBox>
  148. <Label
  149. Content="Раса:"
  150. VerticalAlignment="Center"/>
  151. <ComboBox
  152. Name="RaceFilterComboBox"
  153. SelectionChanged="RaceFilterComboBox_SelectionChanged_3"
  154. VerticalAlignment="Center"
  155. MinWidth="100"
  156. SelectedIndex="0"
  157. ItemsSource="{Binding HeroRaceList}">
  158. <ComboBox.ItemTemplate>
  159. <DataTemplate>
  160. <Label
  161. Content="{Binding title}"/>
  162. </DataTemplate>
  163. </ComboBox.ItemTemplate>
  164. </ComboBox>
  165. <!-- минимальную высоту я тут поставил, чтобы верхнюю строку сетки было видно. В реальном приложении она не нужна -->
  166. </WrapPanel>
  167. </Grid>
  168. </Window>