<Window x:Class="WpfApp3.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp3"
        mc:Ignorable="d"
        Title="University" Height="450" Width="900">
    <Window.Resources>
        <Style x:Key="StackStyle" TargetType="ListBox">
            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Vertical"/>
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="WrapStyle" TargetType="ListBox">
            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <WrapPanel HorizontalAlignment="Right" ItemWidth="200"/>
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
    <Window.Background>
        <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
            <GradientStop Color="LightPink" Offset="0"/>
            <GradientStop Color="LightYellow" Offset="0.5"/>
            <GradientStop Color="LightGreen" Offset="1"/>
        </LinearGradientBrush>
    </Window.Background>
    <Grid ShowGridLines="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition />
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <!-- типа логотип компании -->
        <Image Source="/img/student.jpg" Grid.RowSpan="2"/>

        <StackPanel Orientation="Vertical" Grid.RowSpan="3" VerticalAlignment="Bottom">
            <Button x:Name="ExitButton" Content="Выход" Style="{x:Null}" Click="ExitButton_Click" Height="50"/>
        </StackPanel>

        <StackPanel>
            <ComboBox x:Name="styleBox" />
            <Button Content="Hello WPF" Style="{DynamicResource ButtonStyle}" />
            <TextBlock Text="Windows Presentation Foundation" Style="{DynamicResource TextBlockStyle}" />
        </StackPanel>
        <WrapPanel Orientation="Horizontal" Grid.Column="1" MinHeight="50">
            <TextBox x:Name="NameFilter" Width="100" Margin="5" TextChanged="NameFilter_TextChanged" />
            <TextBox x:Name="NationFilter" Width="100" Margin="5" TextChanged="NationFilter_TextChanged" />
            <Button Content="Применить фильтр" Margin="5" />
            <Button x:Name="ToggleViewButton" Content="Переключить вид" Click="ToggleViewButton_Click" Margin="5" />
        </WrapPanel>

        <ListBox x:Name="StudentListBox"
                 Grid.Row="1"
                 Grid.Column="1"
                 Background="White"
                 ItemsSource="{Binding StudentList}"
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                 Style="{StaticResource WrapStyle}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Border BorderThickness="1" BorderBrush="Black" CornerRadius="5" Width="300">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="100" />

                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="100" />
                            </Grid.ColumnDefinitions>

                            <Image Width="64" Height="64" Source="/img/студент.png" />

                            <StackPanel Grid.Column="1" Margin="5" Orientation="Vertical">
                                <TextBlock Text="{Binding Name}"/>
                                <TextBlock Text="{Binding Country}"/>
                            </StackPanel>

                            <TextBlock Grid.Column="2" Text="{Binding Age}" HorizontalAlignment="Right" />
                        </Grid>
                    </Border>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

    </Grid>
</Window>