<Page x:Class="CatProject.CatViewPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:CatProject"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800" MinHeight="800" MinWidth="600"
      Title="CatViewPage" FontSize="16">
    <Page.Resources>
        <BitmapImage x:Key="defaultImage" UriSource="/Resources/picture.png"></BitmapImage>
    </Page.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="35"></RowDefinition>
            <RowDefinition Height="100"></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition Height="35"></RowDefinition>
        </Grid.RowDefinitions>
        <Button Name="BtnAuto" Click="BtnAuto_Click">Авторизация</Button>
        <StackPanel Grid.Row="1">
            <TextBox Name="TBSearch" TextChanged="TBSearch_TextChanged"></TextBox>
            <ComboBox Name="CBFilterBreed" SelectionChanged="CBFilterBreed_SelectionChanged">
            </ComboBox>
            <CheckBox Name="CBOnly" Checked="CBOnly_Checked" Unchecked="CBOnly_Unchecked">Только мальчики</CheckBox>
            <StackPanel Orientation="Horizontal">
                <RadioButton Name="RBUp" Checked="RBUp_Checked">По имени по возрастанию</RadioButton>
                <RadioButton Name="RBDown" Checked="RBUp_Checked">По имени по убыванию</RadioButton>
                <RadioButton Name="RBNow" Checked="RBUp_Checked">Без сортировки</RadioButton>
            </StackPanel>
        </StackPanel>
        <ListView Grid.Row="2" Name="CatList" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
            <ListView.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel HorizontalAlignment="Center"></WrapPanel>
                </ItemsPanelTemplate>
            </ListView.ItemsPanel>
            <ListView.ItemTemplate>
                <DataTemplate>
                    <Border Padding="5" CornerRadius="5" BorderThickness="5" BorderBrush="#445c93">
                        <Grid Width="350" Height="300" Background="{Binding GenderColor}">
                            <StackPanel>
                                <Image Source="{Binding Photo, TargetNullValue={StaticResource defaultImage}}" Width="200" Height="100"/>
                                <TextBlock Text="{Binding CatAndColor}"></TextBlock>
                                <TextBlock Text="{Binding Birthday, StringFormat={}dd.MM.yyyy}"></TextBlock>
                                <TextBlock Text="{Binding BreedTable.Breed}"></TextBlock>
                                <TextBlock Uid="{Binding idCat}" Loaded="TextBlock_Loaded" TextWrapping="Wrap"></TextBlock>
                                <TextBlock Uid="{Binding idCat}" Loaded="TextBlock_Loaded_1"></TextBlock>
                                <Button Uid="{Binding idCat}" Click="Button_Click">Редактировать</Button>
                                <Button Uid="{Binding idCat}" Click="Button_Click_1">Удалить</Button>
                            </StackPanel>
                        </Grid>
                    </Border>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
        <Button Name="AddCat" Grid.Row="3" Click="AddCat_Click"> Добавить кота</Button>
    </Grid>
</Page>
