Загрузка данных


<Window x:Class="SportShop.Catalog"
        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:SportShop"
        mc:Ignorable="d"
        Title="Catalog" Height="450" Width="800" MinHeight="450" MinWidth="800">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="70"/>
            <RowDefinition/>
            <RowDefinition Height="70"/>
        </Grid.RowDefinitions>

        <Grid Grid.Row="0"  Background="#7FFF00">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100"/>
                <ColumnDefinition Width="2*"/>
                <ColumnDefinition Width="3*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="btnBack" Grid.Column="0" Content="Назад" Margin="10" Style="{StaticResource btnMain}" Click="btnBack_Click"/>
            <TextBlock Grid.Column="1" Text="Товары" Style="{StaticResource textStyle}"/>
            <TextBlock Grid.Column="2" Name="textName" Text="Гость" Style="{StaticResource textStyle}"/>
        </Grid>

        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="2*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <ListBox Name="lbCard" HorizontalContentAlignment="Stretch" HorizontalAlignment="Stretch">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Border x:Name="border" HorizontalAlignment="Stretch" BorderThickness="1" BorderBrush="Aqua">
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
                                <Image Source="/Resourses/picture.png" Height="100"/>

                                <StackPanel Orientation="Vertical" Margin="10 0">
                                    <TextBlock FontWeight="Bold">
                                        <Run Text="{Binding Path=Category.Name}"/>
                                        <Run Text="|"/>
                                        <Run Text="{Binding Path=ProductName.Name}"/>
                                    </TextBlock>

                                    <TextBlock Text="{Binding Path=Description, StringFormat=Описание товара: {0}}"/>
                                    <TextBlock Text="{Binding Path=Manufacturer.Name, StringFormat=Производитель: {0}}"/>
                                    <TextBlock Text="{Binding Path=Provider.Name, StringFormat=Поставщик: {0}}"/>
                                    <TextBlock Text="{Binding Path=Price, StringFormat=Цена: {0}}"/>
                                    <TextBlock Text="{Binding Path=Measure.Name, StringFormat=Единица измерения: {0}}"/>
                                    <TextBlock Text="{Binding Path=Amount, StringFormat=Количество на складе: {0}}"/>
                                </StackPanel>

                                <StackPanel Margin="10 0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                                    <TextBlock Text="{Binding Path=Discount}"/>
                                    <TextBlock Text="%"/>
                                </StackPanel>


                            </StackPanel>


                        </Border>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

            <StackPanel x:Name="spSort" Grid.Column="1" Orientation="Vertical">
                <TextBlock Style="{StaticResource textStyle}" Text="Поиск товаров" Margin="0 20 0 10"/>
                <TextBox x:Name="tbSearch" Margin="10 0" TextChanged="tbSearch_TextChanged"/>

                <TextBlock Style="{StaticResource textStyle}" Text="Сортировка по поставщикам" Margin="0 20 0 10"/>
                <ComboBox x:Name="cbProvider" Margin="10 0"/>

                <TextBlock Style="{StaticResource textStyle}" Text="Сортировка товаров" Margin="0 20 0 10"/>
                <RadioButton x:Name="rbUp" Content="По возрастанию" Margin="10 0 0 0"  GroupName="rbProd" Click="rbUp_Click"/>
                <RadioButton x:Name="rbDown" Content="По убыванию" Margin="10 0 0 0" GroupName="rbProd" Click="rbDown_Click"/>
            </StackPanel>
        </Grid>

        <UniformGrid Grid.Row="2" Columns="3"  Background="#7FFF00">
            <Button Margin="10" x:Name="btnAdd" Content="Добавить" Style="{StaticResource btnMain}"/>
            <Button Margin="10" x:Name="btnDelete" Content="Удалить" Style="{StaticResource btnMain}"/>
            <Button Margin="10" x:Name="btnOrder" Content="Заказы" Style="{StaticResource btnMain}"/>
        </UniformGrid>
    </Grid>
</Window>