133 lines
6.5 KiB
XML
133 lines
6.5 KiB
XML
<Page x:Class="ChudoObuv.Pages.CatalogPage"
|
||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
FontFamily="Calibri" FontSize="16" Background="{StaticResource MainBackgroundBrush}"
|
||
Title="Каталог товаров"
|
||
Loaded="Page_Loaded">
|
||
<Grid Margin="8">
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="Auto" />
|
||
<RowDefinition Height="Auto" />
|
||
<RowDefinition Height="*" />
|
||
<RowDefinition Height="Auto" />
|
||
</Grid.RowDefinitions>
|
||
<!-- Поиск, фильтрация и сортировка: только для авторизованных пользователей -->
|
||
<Grid Grid.Row="0" x:Name="FilterPanel">
|
||
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="*" />
|
||
<ColumnDefinition Width="230" />
|
||
<ColumnDefinition Width="230" />
|
||
</Grid.ColumnDefinitions>
|
||
<StackPanel Grid.Column="0">
|
||
<TextBlock Text="Поиск по наименованию и описанию:" Margin="4,0" />
|
||
<TextBox x:Name="SearchTextBox" TextChanged="Filter_Changed" MaxLength="100" />
|
||
</StackPanel>
|
||
<StackPanel Grid.Column="1">
|
||
<TextBlock Text="Категория:" Margin="4,0" />
|
||
<ComboBox x:Name="CategoryComboBox" SelectionChanged="Filter_Changed" />
|
||
</StackPanel>
|
||
<StackPanel Grid.Column="2">
|
||
<TextBlock Text="Сортировка по цене:" Margin="4,0" />
|
||
<ComboBox x:Name="SortComboBox" SelectionChanged="Filter_Changed">
|
||
<ComboBoxItem Content="Без сортировки" IsSelected="True" />
|
||
<ComboBoxItem Content="По возрастанию цены" />
|
||
<ComboBoxItem Content="По убыванию цены" />
|
||
|
||
</ComboBox>
|
||
</StackPanel>
|
||
</Grid>
|
||
<!-- Действия с заказом -->
|
||
<DockPanel Grid.Row="1" Margin="0,4">
|
||
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
|
||
<Button x:Name="CartButton" Style="{StaticResource AccentButton}"
|
||
Click="CartButton_Click" />
|
||
<Button x:Name="OrdersButton" Content="Список заказов" Click="OrdersButton_Click" />
|
||
</StackPanel>
|
||
<TextBlock x:Name="OrderClientText" VerticalAlignment="Center" Margin="4,0"
|
||
FontStyle="Italic" TextWrapping="Wrap" />
|
||
</DockPanel>
|
||
<ListView Grid.Row="2" x:Name="ProductsListView"
|
||
SelectionChanged="ProductsListView_SelectionChanged"
|
||
HorizontalContentAlignment="Stretch"
|
||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||
BorderThickness="0">
|
||
<ListView.ItemTemplate>
|
||
<DataTemplate>
|
||
<Border BorderBrush="Black" BorderThickness="1" Padding="8" Margin="2">
|
||
<Border.Style>
|
||
<Style TargetType="Border">
|
||
<Setter Property="Background" Value="{StaticResource
|
||
MainBackgroundBrush}" />
|
||
<Style.Triggers>
|
||
<!-- Остаток по всем размерам три пары и меньше — подсветка -->
|
||
<DataTrigger Binding="{Binding IsLowStock}" Value="True">
|
||
<Setter Property="Background" Value="{StaticResource
|
||
LowStockBrush}" />
|
||
</DataTrigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
</Border.Style>
|
||
<Grid>
|
||
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="180" />
|
||
<ColumnDefinition Width="*" />
|
||
<ColumnDefinition Width="170" />
|
||
|
||
</Grid.ColumnDefinitions>
|
||
<Image Grid.Column="0" Source="{Binding ImagePath}" Height="110"
|
||
Stretch="Uniform" Margin="0,0,12,0" />
|
||
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
||
<TextBlock Text="{Binding Title}" FontSize="20" FontWeight="Bold"
|
||
TextWrapping="Wrap" />
|
||
<TextBlock Margin="0,4,0,0" FontSize="17">
|
||
<Run Text="Категория:" /> <Run Text="{Binding Category,
|
||
Mode=OneWay}" />
|
||
</TextBlock>
|
||
|
||
<TextBlock FontSize="17">
|
||
|
||
<Run Text="Количество:" /> <Run Text="{Binding QuantityLabel,
|
||
Mode=OneWay}" FontWeight="Bold" />
|
||
</TextBlock>
|
||
|
||
|
||
<TextBlock FontSize="15" TextWrapping="Wrap">
|
||
<Run Text="Состав:" /> <Run Text="{Binding Composition,
|
||
Mode=OneWay}" />
|
||
</TextBlock>
|
||
</StackPanel>
|
||
<StackPanel Grid.Column="2" VerticalAlignment="Center"
|
||
HorizontalAlignment="Right">
|
||
<TextBlock Text="{Binding Price, StringFormat={}{0:N2} ₽}" FontSize="16"
|
||
TextDecorations="Strikethrough" Foreground="DimGray"
|
||
HorizontalAlignment="Right">
|
||
<TextBlock.Style>
|
||
<Style TargetType="TextBlock">
|
||
<Setter Property="Visibility" Value="Collapsed" />
|
||
|
||
<Style.Triggers>
|
||
|
||
<DataTrigger Binding="{Binding HasDiscount}"
|
||
Value="True">
|
||
<Setter Property="Visibility" Value="Visible" />
|
||
</DataTrigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
</TextBlock.Style>
|
||
</TextBlock>
|
||
|
||
<TextBlock Text="{Binding DiscountedPrice, StringFormat={}{0:N2} ₽}"
|
||
|
||
FontSize="24"
|
||
FontWeight="Bold" HorizontalAlignment="Right" />
|
||
</StackPanel>
|
||
</Grid>
|
||
</Border>
|
||
</DataTemplate>
|
||
</ListView.ItemTemplate>
|
||
</ListView>
|
||
<TextBlock Grid.Row="3" x:Name="CountText" Margin="4" Foreground="DimGray" />
|
||
</Grid>
|
||
</Page> |