MainWindow.xaml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <Window x:Class="WpfApp3.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:WpfApp3"
  7. mc:Ignorable="d"
  8. Title="Основная информация о студенте" Height="450" Width="900">
  9. <Window.Resources>
  10. <Style x:Key="StackStyle" TargetType="ListBox">
  11. <Setter Property="ItemsPanel">
  12. <Setter.Value>
  13. <ItemsPanelTemplate>
  14. <StackPanel Orientation="Vertical"/>
  15. </ItemsPanelTemplate>
  16. </Setter.Value>
  17. </Setter>
  18. </Style>
  19. <Style x:Key="WrapStyle" TargetType="ListBox">
  20. <Setter Property="ItemsPanel">
  21. <Setter.Value>
  22. <ItemsPanelTemplate>
  23. <WrapPanel HorizontalAlignment="Right" ItemWidth="200"/>
  24. </ItemsPanelTemplate>
  25. </Setter.Value>
  26. </Setter>
  27. </Style>
  28. </Window.Resources>
  29. <Window.Background>
  30. <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
  31. <GradientStop Color="LightPink" Offset="0"/>
  32. <GradientStop Color="LightYellow" Offset="0.5"/>
  33. <GradientStop Color="LightGreen" Offset="1"/>
  34. </LinearGradientBrush>
  35. </Window.Background>
  36. <Grid ShowGridLines="True">
  37. <Grid.RowDefinitions>
  38. <RowDefinition Height="auto"/>
  39. <RowDefinition />
  40. <RowDefinition Height="auto"/>
  41. </Grid.RowDefinitions>
  42. <Grid.ColumnDefinitions>
  43. <ColumnDefinition Width="200"/>
  44. <ColumnDefinition/>
  45. </Grid.ColumnDefinitions>
  46. <!-- типа логотип компании -->
  47. <Image Source="/img/student.jpg" Grid.RowSpan="2"/>
  48. <StackPanel Orientation="Vertical" Grid.RowSpan="3" VerticalAlignment="Bottom">
  49. <Button x:Name="ExitButton" Content="Выход" Style="{x:Null}" Click="ExitButton_Click" Height="50"/>
  50. </StackPanel>
  51. <StackPanel>
  52. <ComboBox x:Name="styleBox" />
  53. <Button Content="Hello WPF" Style="{DynamicResource ButtonStyle}" />
  54. <TextBlock Text="Windows Presentation Foundation" Style="{DynamicResource TextBlockStyle}" />
  55. </StackPanel>
  56. <WrapPanel Orientation="Horizontal" Grid.Column="1" MinHeight="50">
  57. <TextBox x:Name="NameFilter" Width="100" Margin="5" TextChanged="NameFilter_TextChanged" />
  58. <TextBox x:Name="NationFilter" Width="100" Margin="5" TextChanged="NationFilter_TextChanged" />
  59. <Button Content="Применить фильтр" Margin="5" />
  60. <Button x:Name="ToggleViewButton" Content="Переключить вид" Click="ToggleViewButton_Click" Margin="5" />
  61. </WrapPanel>
  62. <ListBox x:Name="StudentListBox"
  63. Grid.Row="1"
  64. Grid.Column="1"
  65. Background="White"
  66. ItemsSource="{Binding StudentList}"
  67. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  68. MouseDoubleClick="StudentListBox_MouseDoubleClick"
  69. Style="{StaticResource WrapStyle}">
  70. <ListBox.ItemTemplate>
  71. <DataTemplate>
  72. <Border BorderThickness="1" BorderBrush="Black" CornerRadius="5" Width="300">
  73. <Grid>
  74. <Grid.ColumnDefinitions>
  75. <ColumnDefinition Width="100" />
  76. <ColumnDefinition Width="*" />
  77. <ColumnDefinition Width="100" />
  78. </Grid.ColumnDefinitions>
  79. <Image Width="64" Height="64" Source="/img/студент.png" />
  80. <StackPanel Grid.Column="1" Margin="5" Orientation="Vertical">
  81. <TextBlock Text="{Binding Name}"/>
  82. <TextBlock Text="{Binding Country}"/>
  83. </StackPanel>
  84. <TextBlock Grid.Column="2" Text="{Binding Age}" HorizontalAlignment="Right" />
  85. </Grid>
  86. </Border>
  87. </DataTemplate>
  88. </ListBox.ItemTemplate>
  89. </ListBox>
  90. </Grid>
  91. </Window>