<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="Musical Store" Height="450" Width="800">
    <Window.Resources>
        <BitmapImage
            x:Key="defaultImage"
            UriSource="./Images/20.-1.png"/>
    </Window.Resources>
    <Grid ShowGridLines="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Image 
        Source="./assets/Guitar.jpg" HorizontalAlignment="Right" Margin="0,51,34,47" Width="135" RenderTransformOrigin="0.5,0.5" Grid.RowSpan="2">
            <Image.RenderTransform>
                <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform Angle="-46.766"/>
                    <TranslateTransform/>
                </TransformGroup>
            </Image.RenderTransform>
        </Image>

        <StackPanel Grid.Column="1" Orientation="Horizontal" Margin="10">
            <Label Content="Фильтр:" VerticalAlignment="Center" />
            <ComboBox x:Name="FilterComboBox" SelectionChanged="FilterComboBox_SelectionChanged" Margin="10" />
            <Label Content="Поиск:" VerticalAlignment="Center" />
            <TextBox Width="200" VerticalAlignment="Center" x:Name="SearchFilterTextBox" KeyUp="SearchFilter_KeyUp"/>
        </StackPanel>

        <StackPanel Grid.Column="1" Orientation="Vertical" Grid.Row="2" VerticalAlignment="Bottom">
            <RadioButton GroupName="Sort" Tag="1" Content="по возрастанию" Checked="RadioButtonAsc_Checked" VerticalAlignment="Center"/>
            <RadioButton GroupName="Sort" Tag="2" Content="по убыванию" Checked="RadioButtonDesc_Checked" VerticalAlignment="Center"/>
            <Button x:Name="ExitButton" Content="Выход" Click="ExitButton_Click" Height="50"/>
        </StackPanel>

        <ListBox x:Name="InstrumentListView"
            Grid.Row="1"
            Background="White"
            ItemsSource="{Binding InstrumentListView}" Grid.Column="1">
            <ListBox.ItemContainerStyle>
                <Style 
                    TargetType="ListBoxItem">
                    <Setter 
                        Property="HorizontalContentAlignment"
                        Value="Stretch" />
                </Style>
            </ListBox.ItemContainerStyle>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Border 
                        BorderThickness="1" 
                        BorderBrush="Black" 
                        CornerRadius="5">
                        <Grid 
                            Margin="10" 
                            HorizontalAlignment="Stretch">

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="64"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                            <Image
                                Width="64" 
                                Height="64"
                                Source="{Binding ImageBitmap,TargetNullValue={StaticResource defaultImage}}" />
                            <StackPanel
                                Grid.Column="1"
                                Margin="5"
                                Orientation="Vertical">

                                <TextBlock 
                                        Text="{Binding Name}"/>
                                <TextBlock 
                                        Text="{Binding Brand}"/>
                                <TextBlock 
                                        Grid.Column="2"
                                        Text="{Binding Price}"/>
                            </StackPanel>
                        </Grid>
                    </Border>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</Window>