MainWindow.xaml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <Window x:Class="WpfApp4.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:WpfApp4"
  7. mc:Ignorable="d"
  8. Title="MainWindow" Height="450" Width="740">
  9. <Grid ShowGridLines="True">
  10. <Grid.RowDefinitions>
  11. <RowDefinition Height="auto"/>
  12. <RowDefinition />
  13. <RowDefinition Height="auto"/>
  14. </Grid.RowDefinitions>
  15. <Grid.ColumnDefinitions>
  16. <ColumnDefinition Width="200"/>
  17. <ColumnDefinition/>
  18. </Grid.ColumnDefinitions>
  19. <!-- типа логотип компании -->
  20. <Image
  21. Source="img/portrait.jpg"
  22. Grid.RowSpan="2" HorizontalAlignment="Right"/>
  23. <DataGrid
  24. Grid.Row="1"
  25. Grid.Column="1"
  26. CanUserAddRows="False"
  27. AutoGenerateColumns="False"
  28. ItemsSource="{Binding HeroList}">
  29. <DataGrid.Columns>
  30. <DataGridTextColumn
  31. Header="Имя"
  32. Binding="{Binding name}"/>
  33. <DataGridTextColumn
  34. Header="Возраст"
  35. Binding="{Binding Age}"/>
  36. <DataGridTextColumn
  37. Header="Мощь"
  38. Binding="{Binding power}"/>
  39. <DataGridTextColumn
  40. Header="Раса"
  41. Binding="{Binding race}"/>
  42. </DataGrid.Columns>
  43. </DataGrid>
  44. <StackPanel
  45. Orientation="Vertical"
  46. Grid.RowSpan="3"
  47. VerticalAlignment="Bottom">
  48. <Button
  49. x:Name="ExitButton"
  50. Content="Выход"
  51. Click="ExitButton_Click"
  52. Height="50"/>
  53. </StackPanel>
  54. <WrapPanel
  55. Orientation="Horizontal"
  56. Grid.Column="1"
  57. MinHeight="50">
  58. <Label
  59. Content="Возраст:"
  60. VerticalAlignment="Center"/>
  61. <RadioButton
  62. GroupName="Age"
  63. Tag="1"
  64. Content="по возрастанию"
  65. IsChecked="True"
  66. Checked="RadioButton_Checked"
  67. VerticalAlignment="Center"/>
  68. <RadioButton
  69. GroupName="Age"
  70. Tag="2"
  71. Content="по убыванию "
  72. Checked="RadioButton_Checked"
  73. VerticalAlignment="Center"/>
  74. <Label
  75. Content="Искать:"
  76. VerticalAlignment="Center"/>
  77. <TextBox
  78. Width="200"
  79. VerticalAlignment="Center"
  80. x:Name="SearchFilterTextBox"
  81. KeyUp="SearchFilter_KeyUp"/>
  82. <Label
  83. Content="Мощь:"
  84. VerticalAlignment="Center"/>
  85. <ComboBox
  86. Name="powerFilterComboBox"
  87. SelectionChanged="powerFilterComboBox_SelectionChanged_1"
  88. VerticalAlignment="Center"
  89. MinWidth="100"
  90. SelectedIndex="0"
  91. ItemsSource="{Binding HeroPowerList}">
  92. <ComboBox.ItemTemplate>
  93. <DataTemplate>
  94. <Label
  95. Content="{Binding title}"/>
  96. </DataTemplate>
  97. </ComboBox.ItemTemplate>
  98. </ComboBox>
  99. <Label
  100. Content="Возраст:"
  101. VerticalAlignment="Center"/>
  102. <ComboBox
  103. Name="AgeFilterComboBox"
  104. SelectionChanged="AgeFilterComboBox_SelectionChanged_2"
  105. VerticalAlignment="Center"
  106. MinWidth="100"
  107. SelectedIndex="0"
  108. ItemsSource="{Binding HeroAgeList}">
  109. <ComboBox.ItemTemplate>
  110. <DataTemplate>
  111. <Label
  112. Content="{Binding title}"/>
  113. </DataTemplate>
  114. </ComboBox.ItemTemplate>
  115. </ComboBox>
  116. <Label
  117. Content="Раса:"
  118. VerticalAlignment="Center"/>
  119. <ComboBox
  120. Name="RaceFilterComboBox"
  121. SelectionChanged="RaceFilterComboBox_SelectionChanged_3"
  122. VerticalAlignment="Center"
  123. MinWidth="100"
  124. SelectedIndex="0"
  125. ItemsSource="{Binding HeroRaceList}">
  126. <ComboBox.ItemTemplate>
  127. <DataTemplate>
  128. <Label
  129. Content="{Binding title}"/>
  130. </DataTemplate>
  131. </ComboBox.ItemTemplate>
  132. </ComboBox>
  133. <!-- минимальную высоту я тут поставил, чтобы верхнюю строку сетки было видно. В реальном приложении она не нужна -->
  134. </WrapPanel>
  135. </Grid>
  136. </Window>