demo_trade/Views/ClientProductControl.axaml
2024-10-04 15:41:04 +03:00

75 lines
3.5 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<UserControl xmlns="https://github.com/avaloniaui"
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"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
xmlns:vm="using:demo_trade.ViewModels"
x:DataType="vm:ClientProductViewModel"
xmlns:conv="using:demo_trade.UI.Converters"
x:Class="demo_trade.ClientProductControl">
<UserControl.Resources>
<conv:ItemColorConverter x:Key="itemColorConverter"/>
</UserControl.Resources>
<Grid ColumnDefinitions="*" RowDefinitions="50, *, 50" ShowGridLines="True">
<StackPanel
Margin="5"
Orientation="Horizontal"
DockPanel.Dock="Top"
HorizontalAlignment="Center"
Grid.Row="0"
Spacing="10">
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} {1} {2}">
<Binding Path="AutorizedUser.Usersurname"/>
<Binding Path="AutorizedUser.Username"/>
<Binding Path="AutorizedUser.Userpatronymic"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
<TextBlock Text="{Binding StatisticText}"/>
<TextBox Text="{Binding SearchWord}" MinWidth="200"/>
<ComboBox MinWidth="100" SelectedIndex="{Binding SelectedFilterValue}">
<ComboBoxItem>Все диапазоны</ComboBoxItem>
<ComboBoxItem>0-9.99%</ComboBoxItem>
<ComboBoxItem>10-14.99%</ComboBoxItem>
<ComboBoxItem>15% и болле</ComboBoxItem>
</ComboBox>
<ComboBox MinWidth="100" SelectedIndex="{Binding SelectedSortValue}">
<ComboBoxItem>отсут.</ComboBoxItem>
<ComboBoxItem>по убыв.</ComboBoxItem>
<ComboBoxItem>по возраст.</ComboBoxItem>
</ComboBox>
</StackPanel>
<ListBox ItemsSource="{Binding Products}" Padding="15" Grid.Row="1">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel ContextMenu="" Orientation="Horizontal" Spacing="10" Background="{Binding DiscountAmount, Converter={StaticResource itemColorConverter}}">
<StackPanel.ContextMenu>
<ContextMenu>
<MenuItem Command="{Binding $parent[ListBox].((vm:ClientProductViewModel)DataContext).AddToOrderCommand}" CommandParameter="{Binding}" Header="Добавить в заказ"/>
</ContextMenu>
</StackPanel.ContextMenu>
<Image/>
<StackPanel Orientation="Vertical" >
<TextBlock Text="{Binding Name, StringFormat='Название товара: {0}'}"/>
<TextBlock Text="{Binding Description, StringFormat='Описание товара: {0}'}"/>
<TextBlock Text="{Binding Manufacturer.Name, StringFormat='Производитель товара: {0}' }"/>
</StackPanel>
<Border BorderBrush="Black" BorderThickness="2">
<TextBlock Text="{Binding DiscountAmount, StringFormat='Скидка: {0}%'}"/>
</Border>
<TextBlock Text="{Binding Cost, StringFormat='Цена: {0}'}"/>
<TextBlock Text="{Binding CostWithDiscount, StringFormat='Цена с учетом скидки: {0}'}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<StackPanel Grid.Row="2">
<Button Content="Перейти к заказу" IsVisible="{Binding ThereItemsInOrder}" Command="{Binding AttachToOrderCommand}" VerticalAlignment="Center" HorizontalAlignment="Stretch"/>
<Button Content="Управление заказами" IsVisible="{Binding IsManager}" Command="{Binding AttachToOrderManagerCommand}" VerticalAlignment="Center" HorizontalAlignment="Stretch"/>
</StackPanel>
</Grid>
</UserControl>