<Page x:Class="practica12.Pages.MainPage"
      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:practica12.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="574" d:DesignWidth="950" 
      Title="MainPage">
    <Page.Resources>
        <BitmapImage x:Key="defaultImage" UriSource="/Resourse/NoPhoto.png"/>
    </Page.Resources>
    <Grid>
        <StackPanel Height="574" VerticalAlignment="Bottom">
            

                <TextBlock Text="Туры" FontSize="28" Margin="0,0,0,10" Style="{StaticResource TBStyle}" />
                <StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Center">
                    <TextBlock Text="Введите текс для поиска:" FontSize="20" Margin="5" Style="{StaticResource TBStyle}"/>
                <TextBox Name="Search" TextChanged="Search_TextChanged" Height="20" Width="300" />
                </StackPanel>
                <StackPanel Orientation="Horizontal" Margin="105,0,0,0" HorizontalAlignment="Center">
                    <TextBlock Text="Выберите тип:" FontSize="20" Margin="5" Style="{StaticResource TBStyle}"/>
                <ComboBox  x:Name="ComboBox1"  SelectionChanged="ComboBox1_SelectionChanged"  Height="20" Width="300"  >
                        
                    </ComboBox>
                </StackPanel>
            <StackPanel Orientation="Horizontal" Margin="35,0,0,0"  HorizontalAlignment="Center">
                <TextBlock Margin="5" FontSize="20" Text="Критерий сортировки" Style="{StaticResource TBStyle}"/>
                <StackPanel Height="36" Width="305" Orientation="Horizontal">
                    <ComboBox  x:Name="Sort"   SelectionChanged="Sort_SelectionChanged" Height="20" Width="300" >

                        <ComboBoxItem>Без сотрировки</ComboBoxItem>
                        <ComboBoxItem>По возрастанию</ComboBoxItem>
                        <ComboBoxItem>По убыванию</ComboBoxItem>
                        

                    </ComboBox>
                </StackPanel>
            </StackPanel>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                <CheckBox Name="cbActual" Content="Только актуальные туры" FontSize="14" Checked="cbActual_Checked" Foreground="#445c93" Unchecked="cbActual_Checked" HorizontalAlignment="Center"/>

                <TextBlock Name="tbTotalCostOfTours"  FontSize="20" Foreground="#445c93"  Margin="300,0,0,0" HorizontalAlignment="Right"/>
            </StackPanel>

            <StackPanel>
                    
                    

                <ListView x:Name="lvListTour" Margin="10" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Height="312">
                    <ListView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapPanel HorizontalAlignment="Center"></WrapPanel>
                        </ItemsPanelTemplate>
                    </ListView.ItemsPanel>
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <Border Padding="10" CornerRadius="20" BorderThickness="1" BorderBrush="#445c93">
                                <Grid Width="400" Height="400">
                                    <StackPanel>
                                    <TextBlock Text="{Binding Name}" HorizontalAlignment="Center" FontSize="24" Margin="10" TextWrapping="Wrap" TextAlignment="Center"/>
                                    <Image Width="400" Height="220" Source="{Binding ImagePreview, TargetNullValue={StaticResource defaultImage}}"/>
                                    <TextBlock Text="{Binding Price, StringFormat={}{0:F3} РУБ}" HorizontalAlignment="Center" FontSize="28" FontWeight="Bold" Margin="0,10,0,0"/>
                                        <Grid Margin="0,20,0,0">
                                            <TextBlock Text="{Binding TicketCount, StringFormat={}Билетов: {0}}" HorizontalAlignment="Center" Margin="0, 0, 10, 0"/>
                                    </Grid>
                                </StackPanel>  
                                </Grid>
                            </Border>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </StackPanel>
            <Button Name="btn_hotel" Content="Отели" Click="btn_hotel_Click"  Style="{StaticResource btnstyle1}" />
            </StackPanel>
        
    </Grid>
</Page>
