MainWindow.xaml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <Window x:Class="WpfApp2.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:WpfApp2"
  7. mc:Ignorable="d"
  8. Title="MainWindow" Height="450" Width="800">
  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. <ComboBox
  62. Name="powerFilterComboBox"
  63. SelectionChanged="powerFilterComboBox_SelectionChanged_1"
  64. VerticalAlignment="Center"
  65. MinWidth="100"
  66. SelectedIndex="0"
  67. ItemsSource="{Binding HeroPowerList}">
  68. <ComboBox.ItemTemplate>
  69. <DataTemplate>
  70. <Label
  71. Content="{Binding title}"/>
  72. </DataTemplate>
  73. </ComboBox.ItemTemplate>
  74. </ComboBox>
  75. <Label
  76. Content="Возраст:"
  77. VerticalAlignment="Center"/>
  78. <ComboBox
  79. Name="AgeFilterComboBox"
  80. SelectionChanged="AgeFilterComboBox_SelectionChanged_2"
  81. VerticalAlignment="Center"
  82. MinWidth="100"
  83. SelectedIndex="0"
  84. ItemsSource="{Binding HeroAgeList}">
  85. <ComboBox.ItemTemplate>
  86. <DataTemplate>
  87. <Label
  88. Content="{Binding title}"/>
  89. </DataTemplate>
  90. </ComboBox.ItemTemplate>
  91. </ComboBox>
  92. <Label
  93. Content="Раса:"
  94. VerticalAlignment="Center"/>
  95. <ComboBox
  96. Name="RaceFilterComboBox"
  97. SelectionChanged="RaceFilterComboBox_SelectionChanged_3"
  98. VerticalAlignment="Center"
  99. MinWidth="100"
  100. SelectedIndex="0"
  101. ItemsSource="{Binding HeroRaceList}">
  102. <ComboBox.ItemTemplate>
  103. <DataTemplate>
  104. <Label
  105. Content="{Binding title}"/>
  106. </DataTemplate>
  107. </ComboBox.ItemTemplate>
  108. </ComboBox>
  109. <!-- минимальную высоту я тут поставил, чтобы верхнюю строку сетки было видно. В реальном приложении она не нужна -->
  110. </WrapPanel>
  111. </Grid>
  112. </Window>