MainWindow.xaml 4.6 KB

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