MainWindow.xaml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. <DataGridTextColumn
  43. Header="Дата"
  44. Binding="{Binding dateOfLastVaccination, StringFormat='dd.MM.yyyy'}"/>
  45. </DataGrid.Columns>
  46. </DataGrid>
  47. <StackPanel
  48. Orientation="Vertical"
  49. Grid.RowSpan="3"
  50. VerticalAlignment="Bottom">
  51. <Button
  52. x:Name="ExitButton"
  53. Content="Выход"
  54. Click="ExitButton_Click"
  55. Height="50"/>
  56. </StackPanel>
  57. <WrapPanel
  58. Orientation="Horizontal"
  59. Grid.Column="1"
  60. MinHeight="50">
  61. <Label
  62. Content="Возраст:"
  63. VerticalAlignment="Center"/>
  64. <RadioButton
  65. GroupName="Age"
  66. Tag="1"
  67. Content="по возрастанию"
  68. IsChecked="True"
  69. Checked="RadioButton_Checked"
  70. VerticalAlignment="Center"/>
  71. <RadioButton
  72. GroupName="Age"
  73. Tag="2"
  74. Content="по убыванию "
  75. Checked="RadioButton_Checked"
  76. VerticalAlignment="Center"/>
  77. <Label
  78. Content="Искать:"
  79. VerticalAlignment="Center"/>
  80. <TextBox
  81. Width="200"
  82. VerticalAlignment="Center"
  83. x:Name="SearchFilterTextBox"
  84. KeyUp="SearchFilter_KeyUp"/>
  85. <Label
  86. Content="Мощь:"
  87. VerticalAlignment="Center"/>
  88. <ComboBox
  89. Name="powerFilterComboBox"
  90. SelectionChanged="powerFilterComboBox_SelectionChanged_1"
  91. VerticalAlignment="Center"
  92. MinWidth="100"
  93. SelectedIndex="0"
  94. ItemsSource="{Binding HeroPowerList}">
  95. <ComboBox.ItemTemplate>
  96. <DataTemplate>
  97. <Label
  98. Content="{Binding title}"/>
  99. </DataTemplate>
  100. </ComboBox.ItemTemplate>
  101. </ComboBox>
  102. <Label
  103. Content="Возраст:"
  104. VerticalAlignment="Center"/>
  105. <ComboBox
  106. Name="AgeFilterComboBox"
  107. SelectionChanged="AgeFilterComboBox_SelectionChanged_2"
  108. VerticalAlignment="Center"
  109. MinWidth="100"
  110. SelectedIndex="0"
  111. ItemsSource="{Binding HeroAgeList}">
  112. <ComboBox.ItemTemplate>
  113. <DataTemplate>
  114. <Label
  115. Content="{Binding title}"/>
  116. </DataTemplate>
  117. </ComboBox.ItemTemplate>
  118. </ComboBox>
  119. <Label
  120. Content="Раса:"
  121. VerticalAlignment="Center"/>
  122. <ComboBox
  123. Name="RaceFilterComboBox"
  124. SelectionChanged="RaceFilterComboBox_SelectionChanged_3"
  125. VerticalAlignment="Center"
  126. MinWidth="100"
  127. SelectedIndex="0"
  128. ItemsSource="{Binding HeroRaceList}">
  129. <ComboBox.ItemTemplate>
  130. <DataTemplate>
  131. <Label
  132. Content="{Binding title}"/>
  133. </DataTemplate>
  134. </ComboBox.ItemTemplate>
  135. </ComboBox>
  136. <!-- минимальную высоту я тут поставил, чтобы верхнюю строку сетки было видно. В реальном приложении она не нужна -->
  137. </WrapPanel>
  138. </Grid>
  139. </Window>