demo_trade/Views/OrderShowDialog.axaml

58 lines
3.0 KiB
Plaintext
Raw Normal View History

2024-10-04 12:41:04 +00:00
<Window 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"
x:Class="demo_trade.OrderShowDialog"
xmlns:vm="using:demo_trade.ViewModels"
x:DataType="vm:OrderShowDialogViewModel"
xmlns:asyncImageLoader="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
Title="OrderShowDialog">
<DockPanel>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Spacing="20" HorizontalAlignment="Center">
<TextBlock IsVisible="{Binding UserName, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" Text="{Binding UserName, StringFormat='Пользователь: {0}'}"/>
<TextBlock Text="{Binding OrderSumValue, StringFormat='Общая сумма: {0}'}"/>
<TextBlock Text="{Binding NumberOrder, StringFormat='Номер заказа: {0}'}"/>
<ComboBox ItemsSource="{Binding PickupPoints}" SelectedItem="{Binding PickupPointSelected}" SelectedIndex="{Binding SelectedPointId}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock>
<TextBlock.Text >
<MultiBinding StringFormat="№{0}: {1}">
<Binding Path="PickupPointId"/>
<Binding Path="PickupPointName"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock/>
</StackPanel>
<StackPanel DockPanel.Dock="Bottom">
<Button Content="Сформировать заказ" HorizontalAlignment="Center" Command="{Binding GenerateOrderCommand}" Click="Save_Click"/>
</StackPanel>
<ListBox ItemsSource="{Binding ProductOrderList}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel ContextMenu="" Orientation="Horizontal" Spacing="10">
<Image asyncImageLoader:ImageLoader.Source="{Binding Image}" Height="50" Width="50"/>
<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}'}"/>
<NumericUpDown Value="{Binding ProductCount}" Tag="{Binding ArticleNumber}" Minimum="0" Maximum="{Binding QuantityInStock}" ValueChanged="NumericUpDown_ValueChanged"/>
<TextBlock Text="{Binding CostWithDiscount, StringFormat='Цена с учетом скидки: {0}'}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DockPanel>
</Window>