VPet/VPet-Simulator.Windows/WinDesign/winBetterBuy.xaml
2023-09-24 12:21:39 +08:00

288 lines
20 KiB
XML

<pu:WindowX x:Class="VPet_Simulator.Windows.winBetterBuy"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Topmost="True"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pu="https://opensource.panuon.com/wpf-ui" xmlns:local="clr-namespace:VPet_Simulator.Windows"
mc:Ignorable="d" Title="{ll:Str 更好买}" Height="550" Width="800" FontSize="14"
WindowStartupLocation="CenterScreen" Background="#E0F6FF" pu:WindowXCaption.Height="45"
pu:WindowXCaption.Background="{DynamicResource DARKPrimary}" pu:WindowXCaption.Foreground="#FFFFFF"
pu:WindowXCaption.Buttons="Close" Icon="/Res/BetterBuy.png"
pu:WindowXCaption.ShadowColor="{DynamicResource ShadowColor}" Closing="WindowX_Closing">
<pu:WindowXCaption.CloseButtonStyle>
<Style TargetType="Button" BasedOn="{StaticResource {x:Static pu:WindowXCaption.CloseButtonStyleKey}}">
<Setter Property="Width" Value="28" />
<Setter Property="Height" Value="28" />
<Setter Property="Margin" Value="0,0,7,0" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="pu:ButtonHelper.CornerRadius" Value="14" />
<Setter Property="pu:ButtonHelper.HoverBackground" Value="White" />
<Setter Property="pu:ButtonHelper.ClickBackground" Value="{x:Null}" />
<Setter Property="pu:ButtonHelper.HoverForeground" Value="{DynamicResource DARKPrimary}" />
</Style>
</pu:WindowXCaption.CloseButtonStyle>
<pu:WindowXCaption.HeaderTemplate>
<DataTemplate>
<Grid Margin="10,0">
<StackPanel Orientation="Horizontal">
<Image x:Name="ImageWHY" Width="28" Height="28" Source="/Res/BetterBuy.png"
VerticalAlignment="Center" Margin="30,0,0,0" />
<Button Style="{DynamicResource TextButtonStyle}" Foreground="{DynamicResource DARKPrimaryText}"
Content="{ll:Str 更好买}" VerticalAlignment="Center" FontSize="20" Click="BtnTitle_Click"
pu:WindowX.IsDragMoveArea="False" Margin="10,0,0,0" />
<Grid Grid.Column="1" Margin="15,0,0,0" pu:WindowX.IsDragMoveArea="False" Width="200">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox x:Name="TbTitleSearch" Grid.ColumnSpan="2" VerticalAlignment="Center" Padding="7,0"
pu:TextBoxHelper.Watermark="{ll:Str 搜索商品}" FontSize="14" Background="#33FFFFFF"
Height="30" BorderThickness="0" pu:TextBoxHelper.CornerRadius="5"
Loaded="TbTitleSearch_Loaded" Foreground="{DynamicResource DARKPrimaryText}" />
<Button Grid.Column="1" Margin="0,0,3,0" VerticalAlignment="Center" Height="28" Width="28"
IsDefault="{Binding IsKeyboardFocusWithin, ElementName=TbTitleSearch}"
BorderThickness="0" pu:ButtonHelper.CornerRadius="0,5,5,0" Background="Transparent"
FontFamily="pack://application:,,,/Res/#remixicon" Content="&#xF0D1;" Padding="0"
Foreground="{DynamicResource DARKPrimaryText}" FontSize="16" Cursor="Hand"
Click="BtnSearch_Click" />
</Grid>
<TextBlock VerticalAlignment="Center" Margin="20,0,0,0" FontSize="16" FontWeight="Bold">
<Run Text="{ll:Str 金钱}" />: $ <Run x:Name="rMoney" Loaded="rMoney_Loaded" Text="" />
</TextBlock>
</StackPanel>
<Grid HorizontalAlignment="Right">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<pu:Switch Content="{ll:Str 购买后不自动关闭窗口}" Grid.Column="2" FontSize="14" Margin="10,0,5,0" Height="20"
VerticalAlignment="Center" HorizontalAlignment="Left" BoxHeight="14" ToggleSize="18"
CheckedBackground="{DynamicResource Primary}" CheckedBorderBrush="{DynamicResource Primary}"
Background="Transparent" ToggleShadowColor="{x:Null}"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
ToggleBrush="{DynamicResource PrimaryDark}" pu:WindowX.IsDragMoveArea="False" BoxWidth="30"
Loaded="Switch_Loaded" />
<pu:Switch Content="{ll:Str 让宠物自己买东西吃}" Grid.Column="2" FontSize="14" Margin="10,0,5,0" Height="20"
VerticalAlignment="Center" HorizontalAlignment="Left" BoxHeight="14" ToggleSize="18"
CheckedBackground="{DynamicResource Primary}" CheckedBorderBrush="{DynamicResource Primary}"
Background="Transparent" ToggleShadowColor="{x:Null}"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}" Grid.Row="1"
ToggleBrush="{DynamicResource PrimaryDark}" pu:WindowX.IsDragMoveArea="False" BoxWidth="30"
ToolTip="{ll:Str '当宠物口渴或者饥饿的时候会自己买东西吃\&#13;请注意,宠物可能会乱花钱和吃错误的东西\&#13;额外加收20%外卖运送费用'}"
Loaded="Switch_Loaded_1" />
</Grid>
</Grid>
</DataTemplate>
</pu:WindowXCaption.HeaderTemplate>
<Window.Resources>
<local:BoolToIntConverter x:Key="BoolToIntConverter" />
<local:DiscountPriceConverter x:Key="DiscountPriceConverter" />
<DataTemplate x:Key="CommodityDataTemplate">
<Grid>
<pu:CarouselPanel Grid.Column="1" Animation="Fade,Flow" AnimationDuration="0:0:0.3"
CurrentIndex="{Binding IsChecked, Converter={StaticResource BoolToIntConverter}, ElementName=TbtnDetail}">
<Border Background="{DynamicResource SecondaryTrans4}" CornerRadius="5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border Margin="25,0,0,0" Width="{Binding ActualHeight, ElementName=BdrImage}" />
<TextBlock Grid.ColumnSpan="2" Margin="10,7,0,0" FontWeight="Bold"
TextTrimming="CharacterEllipsis" FontSize="18" Text="{Binding TranslateName}" />
<Grid Grid.Column="1" Margin="0,40,0,10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="1" Orientation="Horizontal">
<TextBlock x:Name="TxtPrice" VerticalAlignment="Bottom"
Text="{Binding Price, StringFormat='$ 0.0'}" FontWeight="Bold" FontSize="18"
Foreground="{DynamicResource DARKPrimary}" />
<!--<TextBlock x:Name="TxtDiscountPrice" Margin="5,0,0,0" FontWeight="Bold"
FontSize="18" Foreground="{DynamicResource DARKPrimary}">
<TextBlock.Text>
<MultiBinding Converter="{StaticResource DiscountPriceConverter}">
<Binding Path="Price" />
<Binding Path="Discount" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>-->
</StackPanel>
<!--<Border Grid.Row="3" Margin="0,5,0,0" HorizontalAlignment="Left"
Background="{DynamicResource SecondaryTrans}" CornerRadius="2">
<StackPanel Orientation="Horizontal">
<RepeatButton VerticalAlignment="Center" Content="-" Padding="0,0,0,5"
Style="{DynamicResource IconInvertedForegroundRepeatButtonStyle}"
Click="RbtnDecrease_Click" />
<TextBox Grid.Column="1" Cursor="IBeam" Background="#CDFFFFFF"
BorderThickness="0" HorizontalContentAlignment="Center"
Text="{Binding Quantity}" MinWidth="30" />
<RepeatButton Grid.Column="2" VerticalAlignment="Center" Content="+"
Padding="0,0,0,5"
Style="{DynamicResource IconInvertedForegroundRepeatButtonStyle}"
Click="RbtnIncrease_Click" />
</StackPanel>
</Border>-->
<Button Grid.Row="4" Margin="0,7,0,0" Padding="7,5" Cursor="Hand"
HorizontalAlignment="Left" pu:ButtonHelper.Icon="&#xF11A;"
Style="{DynamicResource ThemedButtonStyle}" Content="{ll:Str 购买}"
Click="BtnBuy_Click" />
</Grid>
</Grid>
</Border>
<Border Background="{DynamicResource DARKPrimary}" CornerRadius="5">
<Grid>
<Grid Grid.Column="1" Margin="10,10,10,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock VerticalAlignment="Center" TextTrimming="CharacterEllipsis" FontSize="16"
Foreground="{DynamicResource DARKPrimaryText}" Text="{Binding TranslateName}" />
<ScrollViewer Grid.Row="1" Grid.RowSpan="4" Margin="0,7,0,0"
pu:ScrollBarHelper.ThumbBackground="#44FFFFFF"
PreviewMouseWheel="ScrollViewer_PreviewMouseWheel"
pu:ScrollBarHelper.HoverThumbBackground="#88FFFFFF">
<TextBlock TextWrapping="Wrap" Background="Transparent" FontSize="12" Padding="0"
Foreground="{DynamicResource DARKPrimaryText}" Text="{Binding Description}" />
</ScrollViewer>
</Grid>
</Grid>
</Border>
</pu:CarouselPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border x:Name="BdrImage" Margin="10,35,0,10" CornerRadius="5"
Visibility="{Binding IsChecked,Converter={StaticResource {x:Static pu:ConverterKeys.TrueToCollapseConverter}}, ElementName=TbtnDetail}">
<Image Source="{Binding ImageSource}" Stretch="UniformToFill" />
</Border>
<ToggleButton x:Name="TbtnStar" Grid.ColumnSpan="2" Margin="0,5,32,0" HorizontalAlignment="Right"
VerticalAlignment="Top" Width="30" Height="30" Padding="0" FontSize="22"
Foreground="#FFB300" Background="Transparent" ToolTip="{ll:Str 收藏食物}"
pu:ToggleButtonHelper.CornerRadius="5" pu:ToggleButtonHelper.CheckedContent="&#xF186;"
pu:IconHelper.Margin="0" FontFamily="/VPet-Simulator.Windows;component/Res/#remixicon"
Content="&#xF18B;" IsChecked="{Binding Star}" />
<ToggleButton x:Name="TbtnDetail" Grid.ColumnSpan="2" Margin="0,5,8,0" HorizontalAlignment="Right"
VerticalAlignment="Top" Width="30" Height="30" Padding="0" FontSize="22"
Foreground="{DynamicResource DARKPrimaryDarker}" Background="Transparent"
ToolTip="{ll:Str 物品详情}" pu:ToggleButtonHelper.CornerRadius="5"
pu:ToggleButtonHelper.CheckedContent="&#xEF3D;"
pu:ToggleButtonHelper.CheckedForeground="{DynamicResource DARKPrimaryText}"
pu:IconHelper.Margin="0" FontFamily="/VPet-Simulator.Windows;component/Res/#remixicon"
Content="&#xEF3E;" />
</Grid>
</Grid>
<!--<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Discount}" Value="100">
<Setter TargetName="TxtPrice" Property="Foreground" Value="{DynamicResource DARKPrimary}" />
<Setter TargetName="TxtPrice" Property="FontSize" Value="18" />
<Setter TargetName="TxtPrice" Property="TextDecorations" Value="None" />
-->
<!--<Setter TargetName="TxtDiscountPrice" Property="Visibility" Value="Collapsed" />-->
<!--
</DataTrigger>
</DataTemplate.Triggers>-->
</DataTemplate>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border Background="{DynamicResource DARKPrimaryText}" />
<Grid Margin="12, 10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="3*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<TextBlock Text="{ll:Str 商品分类}" FontSize="18" Margin="5" Foreground="{DynamicResource DARKPrimary}" />
<ListBox x:Name="LsbCategory" Grid.Row="1" Margin="-12,10,-12,0" Background="Transparent"
BorderThickness="0" SelectedIndex="0" pu:ListBoxHelper.ItemsPadding="15,8"
pu:ListBoxHelper.ItemsSelectedBackground="{DynamicResource DARKPrimary}"
pu:ListBoxHelper.ItemsSelectedForeground="{DynamicResource DARKPrimaryText}"
SelectionChanged="LsbSortRule_SelectionChanged">
<ListBoxItem Content="{ll:Str 全部}" />
<ListBoxItem Content="{ll:Str 收藏}" />
<ListBoxItem Content="{ll:Str 正餐}" />
<ListBoxItem Content="{ll:Str 零食}" />
<ListBoxItem Content="{ll:Str 饮料}" />
<ListBoxItem Content="{ll:Str 功能性}" />
<ListBoxItem Content="{ll:Str 药品}" />
<ListBoxItem Content="{ll:Str 礼品}" />
</ListBox>
<TextBlock Grid.Row="2" Text="{ll:Str 排序方式}" Margin="5" FontSize="18"
Foreground="{DynamicResource DARKPrimary}" />
<Border Grid.Row="3" Margin="0,10,0,0" MinHeight="100" CornerRadius="5">
<Grid VerticalAlignment="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ListBox x:Name="LsbSortRule" Background="Transparent" BorderThickness="0"
pu:ListBoxHelper.ItemsPadding="10,5" pu:ListBoxHelper.ItemsCornerRadius="4"
pu:ListBoxHelper.ItemsSelectedBackground="{DynamicResource DARKPrimary}"
pu:ListBoxHelper.ItemsSelectedForeground="{DynamicResource DARKPrimaryText}"
SelectedIndex="0" SelectionChanged="LsbSortRule_SelectionChanged">
<ListBoxItem Content="{ll:Str 按名字}" />
<ListBoxItem Content="{ll:Str 按价格}" />
<ListBoxItem Content="{ll:Str 按饱腹度}" />
<ListBoxItem Content="{ll:Str 按口渴度}" />
<ListBoxItem Content="{ll:Str 按体力}" />
<ListBoxItem Content="{ll:Str 按心情}" />
<ListBoxItem Content="{ll:Str 按健康}" />
<ListBoxItem Content="{ll:Str 按经验值}" />
</ListBox>
<Rectangle Grid.Column="1" Margin="10,0,10,0" Width="1" Fill="{DynamicResource DARKPrimaryTrans4}" />
<ListBox x:Name="LsbSortAsc" Grid.Column="2" Background="Transparent" BorderThickness="0"
pu:ListBoxHelper.ItemsPadding="10,5" pu:ListBoxHelper.ItemsCornerRadius="4"
pu:ListBoxHelper.ItemsSelectedBackground="{DynamicResource DARKPrimary}"
pu:ListBoxHelper.ItemsSelectedForeground="{DynamicResource DARKPrimaryText}"
SelectedIndex="0" SelectionChanged="LsbSortRule_SelectionChanged">
<ListBoxItem Content="{ll:Str 升序}" />
<ListBoxItem Content="{ll:Str 降序}" />
</ListBox>
</Grid>
</Border>
</Grid>
<Grid Margin="10" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ItemsControl x:Name="IcCommodity" SizeChanged="AutoUniformGrid_SizeChanged">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<local:AutoUniformGrid VerticalAlignment="Top" ItemsMinWidth="250"
Changed="AutoUniformGrid_Changed" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<ContentControl Height="140" Margin="0,0,10,10" Content="{Binding}"
ContentTemplate="{StaticResource CommodityDataTemplate}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<pu:Pagination x:Name="pagination" Grid.Row="1" Style="{DynamicResource StandardPaginationStyle}"
CurrentPageChanged="pagination_CurrentPageChanged" />
</Grid>
</Grid>
</pu:WindowX>