<Page x:Class="WpfApp1.pgTours"
      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:WpfApp1"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="pgTours">
    <Page.Resources>
        <DataTemplate x:Key="dtTours">
            <Border BorderThickness="1,1,1,1" BorderBrush="Black" Width="250px" Height="250px" >
                <StackPanel Width="250px" Height="250px">
                    <TextBlock Text="{Binding Name}" HorizontalAlignment="Center"></TextBlock>
                    <Image Source="{Binding ToutImage}" Width="150px" Height="150px"></Image>
                    <TextBlock  Text="{Binding Price, StringFormat=\{0:F\}}"  HorizontalAlignment="Center"></TextBlock>
                    <DockPanel Width="240px">
                        <TextBlock Text="{Binding IsActualStr}" Foreground="{Binding IsActualClor}" HorizontalAlignment="Left"></TextBlock>
                        <TextBlock HorizontalAlignment="Right">
                        <Run Text="Билетов: "></Run>
                        <Run Text="{Binding TicketCount}"></Run>
                        </TextBlock>
                    </DockPanel>
                </StackPanel>
            </Border>
        </DataTemplate>
    </Page.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="47*"/>
            <RowDefinition Height="188*"/>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
            <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
                <StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Введите текст для поиска: "></TextBlock>
                        <TextBox Name="tbName" MinWidth="100px" TextChanged="tbName_TextChanged"></TextBox>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Выберите тип: "></TextBlock>
                        <ComboBox Name="cbType" MinWidth="100px" SelectionChanged="cbType_SelectionChanged"></ComboBox>

                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Сортировка цены: "></TextBlock>
                        <ComboBox MinWidth="100px" Name="cbSort" SelectionChanged="cbSort_SelectionChanged">
                            <ComboBoxItem>Сбросить</ComboBoxItem>
                            <ComboBoxItem>По возрастанию</ComboBoxItem>
                            <ComboBoxItem>По убыванию</ComboBoxItem>
                        </ComboBox>
                    </StackPanel>
                    <CheckBox Content="Только актуальные туры" Name="chbIsActual" Checked="chbIsActual_Checked" Unchecked="chbIsActual_Unchecked"></CheckBox>
                </StackPanel>
                <Button Name="btnHotel" Click="btnHotel_Click">Отели</Button>
            </StackPanel>
            <TextBlock Text="Общая цена туров: ">
                <Run Name="rSummPrice"></Run>
            </TextBlock>
        </StackPanel>
       
        <ListBox Grid.Row="1" ItemTemplate="{StaticResource dtTours}" ScrollViewer.HorizontalScrollBarVisibility ="Disabled" Name="lbTours">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel Orientation="Horizontal"></WrapPanel>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
        </ListBox>
    </Grid>
</Page>
