123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- <UserControl x:Class="OOO_WriteAndClear.MVP.Views.ProductsUserControl"
- 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:OOO_WriteAndClear.MVP.Views"
- xmlns:db_models="clr-namespace:OOO_WriteAndClear.DBModels"
- mc:Ignorable="d"
- d:DesignHeight="450" d:DesignWidth="800"
- FontFamily="Comic Sans MS"
- Background="White"
- Loaded="UserControlWasLoaded">
- <UserControl.Resources>
-
- <Style x:Key="ProductsUserControl.ProductList" TargetType="ListView">
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
- <Setter Property="ItemTemplate">
- <Setter.Value>
- <DataTemplate DataType="db_models:Product">
- <Border Padding="10" HorizontalAlignment="Stretch">
- <Border.Style>
- <Style TargetType="Border">
- <Style.Triggers>
- <DataTrigger Binding="{Binding IsBiggerThan15PercentDiscount}" Value="true">
- <Setter Property="Background" Value="#7fff00"/>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
-
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="auto"/>
- <ColumnDefinition />
- <ColumnDefinition Width="auto"/>
- </Grid.ColumnDefinitions>
- <Image Grid.Column="0" Margin="0 0 10 0"
- Width="150" Height="120"
- HorizontalAlignment="Center"
- Source="{Binding ProductImage}"/>
- <StackPanel Grid.Column="1"
- Orientation="Vertical">
- <Label Padding="0" Content="{Binding ProductName}"/>
- <TextBlock TextWrapping="WrapWithOverflow"
- Text="{Binding ProductDescription}"/>
- <StackPanel Orientation="Horizontal">
- <Label Padding="0"
- Content="Производитель: "/>
- <TextBlock Text="{Binding ProductManufacturer.ManufacturerName}"/>
- </StackPanel>
- <StackPanel Orientation="Horizontal">
- <Label Padding="0"
- Content="Цена:"/>
- <StackPanel Orientation="Horizontal">
- <TextBlock Text="{Binding ProductCost, StringFormat={}{0:f2}}"
- TextDecorations="Strikethrough"
- Margin="0 0 5 0">
- <TextBlock.Style>
- <Style TargetType="TextBlock">
- <Style.Triggers>
- <DataTrigger Binding="{Binding ProductDiscountAmount}" Value="{x:Null}">
- <Setter Property="Visibility" Value="Collapsed"/>
- </DataTrigger>
- <DataTrigger Binding="{Binding ProductDiscountAmount}" Value="0">
- <Setter Property="Visibility" Value="Collapsed"/>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </TextBlock.Style>
- </TextBlock>
- <TextBlock Text="{Binding CurrentPrice, StringFormat={}{0:f2} руб.}"/>
- </StackPanel>
- </StackPanel>
- </StackPanel>
- <TextBlock Grid.Column="2"
- Margin="10 0 0 0"
- VerticalAlignment="Center" HorizontalAlignment="Center"
- Text="{Binding ProductDiscountMax, StringFormat={}{0:f2}%}"/>
- </Grid>
- </Border>
- </DataTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <Style x:Key="BackButtonStyle" TargetType="{x:Type Button}">
- <Setter Property="Width" Value="35"/>
- <Setter Property="Height" Value="35"/>
- <Setter Property="Margin" Value="0 0 0 10"/>
- <Setter Property="VerticalAlignment" Value="Top"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Button}">
- <Image Height="{TemplateBinding Height}"
- Width="{TemplateBinding Width}"
- Source="/Assets/Pictures/BackButton.png"/>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </UserControl.Resources>
- <Border Padding="10">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="auto"/>
- <RowDefinition Height="auto"/>
- <RowDefinition/>
- </Grid.RowDefinitions>
- <Label Grid.Row="0"
- Margin="0 0 0 15"
- FontSize="18" FontWeight="Bold"
- Content="Товары"
- HorizontalAlignment="Center" VerticalAlignment="Top"/>
- <Grid HorizontalAlignment="Right" VerticalAlignment="Top"
- Margin="0 0 10 0">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="auto"/>
- <ColumnDefinition/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="auto"/>
- <RowDefinition Height="auto"/>
- </Grid.RowDefinitions>
- <Image Grid.Column="0" Grid.RowSpan="2"
- Height="40" Width="40"
- VerticalAlignment="Top"
- Margin="0 0 10 0"
- Source="/Assets/Pictures/LoginFieldIcon.png"/>
- <TextBlock x:Name="DisplayingUserName"
- Grid.Column="1" Grid.Row="0"
- Text="Гость"
- Margin="0 0 0 5"/>
- <TextBlock x:Name="DisplayingUserRole"
- Grid.Column="1" Grid.Row="1"
- Foreground="Gray"/>
- </Grid>
- <Button Style="{DynamicResource BackButtonStyle}"
- HorizontalAlignment="Left" VerticalAlignment="Top"
- Click="ReturnBack_ButtonClick" />
- <Grid Grid.Row="1" HorizontalAlignment="Stretch">
- <Grid.RowDefinitions>
- <RowDefinition/>
- <RowDefinition/>
- </Grid.RowDefinitions>
- <TextBox x:Name="SearchBar"
- Grid.Row="0"
- Margin="0 0 0 10"
- Width="400"
- HorizontalAlignment="Left"
- TextChanged="SearchBarTextWasChanged"/>
- <StackPanel Grid.Row="0"
- Orientation="Horizontal"
- HorizontalAlignment="Right">
- <TextBlock x:Name="DisplayingProductsCount"
- Text="0"/>
- <TextBlock Text=" из "/>
- <TextBlock x:Name="AllProductsCount"
- Text="0"/>
- </StackPanel>
- <StackPanel Grid.Row="1"
- Margin="0 0 0 10"
- Orientation="Horizontal">
- <GroupBox Margin="0 0 10 0"
- Header="Фильтрация по скидке">
- <ComboBox x:Name="FilterComboBox"
- SelectionChanged="FilterComboBoxSelectionWasChanged"/>
- </GroupBox>
- <GroupBox Header="Сортировка по цене">
- <ComboBox x:Name="SortComboBox"
- SelectionChanged="SortComboBoxSelectionWasChanged"/>
- </GroupBox>
- </StackPanel>
- <Button x:Name="GoToBasketButton"
- Grid.Row="1"
- Background="#498c51" BorderThickness="0" Foreground="White"
- Margin="0 0 0 10"
- HorizontalAlignment="Right" VerticalAlignment="Stretch"
- Visibility="Hidden" Click="GoToOrderCart_ButtonClick">
- <Button.Content>
- <StackPanel Orientation="Horizontal">
- <Label Content="В корзину:"/>
- <Label x:Name="BasketCostLabel"
- Content="0 Руб."/>
- </StackPanel>
- </Button.Content>
- </Button>
- </Grid>
- <ListView x:Name="ProductsList"
- Grid.Row="2" HorizontalAlignment="Stretch"
- Style="{StaticResource ProductsUserControl.ProductList}"
- d:ItemsSource="{d:SampleData ItemCount=5}">
-
- <ListView.ContextMenu>
- <ContextMenu>
-
- <MenuItem Header="Добавить к заказу"
- Click="AddProductToOrder_Button"/>
-
- <MenuItem Header="Убрать из заказа"
- Click="RemoveProductFromOrder_Button"/>
-
- </ContextMenu>
- </ListView.ContextMenu>
-
- </ListView>
- </Grid>
- </Border>
-
- </UserControl>
|