更新 VPet.Solution

This commit is contained in:
Hakoyu 2023-12-30 23:50:37 +08:00
parent 6aac99b85f
commit 9fffaaaa95
33 changed files with 1413 additions and 882 deletions

View File

@ -1,42 +1,43 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <ResourceDictionary
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:pu="https://opensource.panuon.com/wpf-ui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:pucore="clr-namespace:Panuon.WPF;assembly=Panuon.WPF"> xmlns:pu="https://opensource.panuon.com/wpf-ui"
<SolidColorBrush x:Key="Primary" Color="#FF81d4fa" /> xmlns:pucore="clr-namespace:Panuon.WPF;assembly=Panuon.WPF">
<SolidColorBrush x:Key="PrimaryTrans" Color="#DD81d4fa" /> <SolidColorBrush x:Key="Primary" Color="#FF81d4fa" />
<SolidColorBrush x:Key="PrimaryTrans4" Color="#4481d4fa" /> <SolidColorBrush x:Key="PrimaryTrans" Color="#DD81d4fa" />
<SolidColorBrush x:Key="PrimaryTransA" Color="#AA81d4fa" /> <SolidColorBrush x:Key="PrimaryTrans4" Color="#4481d4fa" />
<SolidColorBrush x:Key="PrimaryTransE" Color="#EE81d4fa" /> <SolidColorBrush x:Key="PrimaryTransA" Color="#AA81d4fa" />
<SolidColorBrush x:Key="PrimaryTransE" Color="#EE81d4fa" />
<SolidColorBrush x:Key="PrimaryLight" Color="#FFA3E2FF" /> <SolidColorBrush x:Key="PrimaryLight" Color="#FFA3E2FF" />
<SolidColorBrush x:Key="PrimaryLighter" Color="#FFC1EBFF" /> <SolidColorBrush x:Key="PrimaryLighter" Color="#FFC1EBFF" />
<SolidColorBrush x:Key="PrimaryDark" Color="#FF5CBEEA" /> <SolidColorBrush x:Key="PrimaryDark" Color="#FF5CBEEA" />
<SolidColorBrush x:Key="PrimaryDarker" Color="#FF3CA9DB" /> <SolidColorBrush x:Key="PrimaryDarker" Color="#FF3CA9DB" />
<SolidColorBrush x:Key="PrimaryText" Color="#FF000000" /> <SolidColorBrush x:Key="PrimaryText" Color="#FF000000" />
<SolidColorBrush x:Key="Secondary" Color="#FF90caf9" /> <SolidColorBrush x:Key="Secondary" Color="#FF90caf9" />
<SolidColorBrush x:Key="SecondaryTrans" Color="#DD90caf9" /> <SolidColorBrush x:Key="SecondaryTrans" Color="#DD90caf9" />
<SolidColorBrush x:Key="SecondaryTrans4" Color="#4490caf9" /> <SolidColorBrush x:Key="SecondaryTrans4" Color="#4490caf9" />
<SolidColorBrush x:Key="SecondaryTransA" Color="#AA90caf9" /> <SolidColorBrush x:Key="SecondaryTransA" Color="#AA90caf9" />
<SolidColorBrush x:Key="SecondaryTransE" Color="#EE90caf9" /> <SolidColorBrush x:Key="SecondaryTransE" Color="#EE90caf9" />
<SolidColorBrush x:Key="SecondaryLight" Color="#FFADD7F9" /> <SolidColorBrush x:Key="SecondaryLight" Color="#FFADD7F9" />
<SolidColorBrush x:Key="SecondaryLighter" Color="#FFCBE4F9" /> <SolidColorBrush x:Key="SecondaryLighter" Color="#FFCBE4F9" />
<SolidColorBrush x:Key="SecondaryDark" Color="#FF6BB1E9" /> <SolidColorBrush x:Key="SecondaryDark" Color="#FF6BB1E9" />
<SolidColorBrush x:Key="SecondaryDarker" Color="#FF4999DA" /> <SolidColorBrush x:Key="SecondaryDarker" Color="#FF4999DA" />
<SolidColorBrush x:Key="SecondaryText" Color="#FF000000" /> <SolidColorBrush x:Key="SecondaryText" Color="#FF000000" />
<SolidColorBrush x:Key="DARKPrimary" Color="#FF039be5" /> <SolidColorBrush x:Key="DARKPrimary" Color="#FF039be5" />
<SolidColorBrush x:Key="DARKPrimaryTrans" Color="#DD039be5" /> <SolidColorBrush x:Key="DARKPrimaryTrans" Color="#DD039be5" />
<SolidColorBrush x:Key="DARKPrimaryTrans4" Color="#44039be5" /> <SolidColorBrush x:Key="DARKPrimaryTrans4" Color="#44039be5" />
<SolidColorBrush x:Key="DARKPrimaryTransA" Color="#AA039be5" /> <SolidColorBrush x:Key="DARKPrimaryTransA" Color="#AA039be5" />
<SolidColorBrush x:Key="DARKPrimaryTransE" Color="#EE039be5" /> <SolidColorBrush x:Key="DARKPrimaryTransE" Color="#EE039be5" />
<SolidColorBrush x:Key="DARKPrimaryLight" Color="#FF1FA9EC" /> <SolidColorBrush x:Key="DARKPrimaryLight" Color="#FF1FA9EC" />
<SolidColorBrush x:Key="DARKPrimaryLighter" Color="#FF3DB8F4" /> <SolidColorBrush x:Key="DARKPrimaryLighter" Color="#FF3DB8F4" />
<SolidColorBrush x:Key="DARKPrimaryDark" Color="#FF0290D5" /> <SolidColorBrush x:Key="DARKPrimaryDark" Color="#FF0290D5" />
<SolidColorBrush x:Key="DARKPrimaryDarker" Color="#FF0286C6" /> <SolidColorBrush x:Key="DARKPrimaryDarker" Color="#FF0286C6" />
<SolidColorBrush x:Key="DARKPrimaryText" Color="#FFffffff" /> <SolidColorBrush x:Key="DARKPrimaryText" Color="#FFffffff" />
<Color x:Key="ShadowColor">#90caf9</Color> <Color x:Key="ShadowColor">#90caf9</Color>
</ResourceDictionary> </ResourceDictionary>

View File

@ -1,307 +1,364 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <ResourceDictionary
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:pu="https://opensource.panuon.com/wpf-ui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:pucore="clr-namespace:Panuon.WPF;assembly=Panuon.WPF"> xmlns:pu="https://opensource.panuon.com/wpf-ui"
<ResourceDictionary.MergedDictionaries> xmlns:pucore="clr-namespace:Panuon.WPF;assembly=Panuon.WPF">
<pucore:SharedResourceDictionary Source="/Panuon.WPF.UI;component/Control.xaml" /> <ResourceDictionary.MergedDictionaries>
</ResourceDictionary.MergedDictionaries> <pucore:SharedResourceDictionary Source="/Panuon.WPF.UI;component/Control.xaml" />
</ResourceDictionary.MergedDictionaries>
<DrawingBrush x:Key="ProgressBarForeground" Viewport="0,0,8,22" ViewportUnits="Absolute" Stretch="None" <DrawingBrush
TileMode="Tile"> x:Key="ProgressBarForeground"
<DrawingBrush.RelativeTransform> Stretch="None"
<RotateTransform Angle="2" /> TileMode="Tile"
</DrawingBrush.RelativeTransform> Viewport="0,0,8,22"
<DrawingBrush.Drawing> ViewportUnits="Absolute">
<DrawingGroup> <DrawingBrush.RelativeTransform>
<GeometryDrawing Brush="{DynamicResource DARKPrimaryTransA}"> <RotateTransform Angle="2" />
<GeometryDrawing.Geometry> </DrawingBrush.RelativeTransform>
<GeometryGroup> <DrawingBrush.Drawing>
<RectangleGeometry Rect="5.5,0,2.5,22" /> <DrawingGroup>
</GeometryGroup> <GeometryDrawing Brush="{DynamicResource DARKPrimaryTransA}">
</GeometryDrawing.Geometry> <GeometryDrawing.Geometry>
</GeometryDrawing> <GeometryGroup>
<GeometryDrawing Brush="{DynamicResource DARKPrimary}"> <RectangleGeometry Rect="5.5,0,2.5,22" />
<GeometryDrawing.Geometry> </GeometryGroup>
<GeometryGroup> </GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,0,5.5,22" /> </GeometryDrawing>
</GeometryGroup> <GeometryDrawing Brush="{DynamicResource DARKPrimary}">
</GeometryDrawing.Geometry> <GeometryDrawing.Geometry>
</GeometryDrawing> <GeometryGroup>
</DrawingGroup> <RectangleGeometry Rect="0,0,5.5,22" />
</DrawingBrush.Drawing> </GeometryGroup>
</DrawingBrush> </GeometryDrawing.Geometry>
<DrawingBrush x:Key="SuccessProgressBarForeground" Viewport="0,0,8,22" ViewportUnits="Absolute" Stretch="None" </GeometryDrawing>
TileMode="Tile"> </DrawingGroup>
<DrawingBrush.RelativeTransform> </DrawingBrush.Drawing>
<RotateTransform Angle="2" /> </DrawingBrush>
</DrawingBrush.RelativeTransform> <DrawingBrush
<DrawingBrush.Drawing> x:Key="SuccessProgressBarForeground"
<DrawingGroup> Stretch="None"
<GeometryDrawing Brush="#AAAACC6C"> TileMode="Tile"
<GeometryDrawing.Geometry> Viewport="0,0,8,22"
<GeometryGroup> ViewportUnits="Absolute">
<RectangleGeometry Rect="5.5,0,2.5,22" /> <DrawingBrush.RelativeTransform>
</GeometryGroup> <RotateTransform Angle="2" />
</GeometryDrawing.Geometry> </DrawingBrush.RelativeTransform>
</GeometryDrawing> <DrawingBrush.Drawing>
<GeometryDrawing Brush="#AACC6C"> <DrawingGroup>
<GeometryDrawing.Geometry> <GeometryDrawing Brush="#AAAACC6C">
<GeometryGroup> <GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,0,5.5,22" /> <GeometryGroup>
</GeometryGroup> <RectangleGeometry Rect="5.5,0,2.5,22" />
</GeometryDrawing.Geometry> </GeometryGroup>
</GeometryDrawing> </GeometryDrawing.Geometry>
</DrawingGroup> </GeometryDrawing>
</DrawingBrush.Drawing> <GeometryDrawing Brush="#AACC6C">
</DrawingBrush> <GeometryDrawing.Geometry>
<DrawingBrush x:Key="WarningProgressBarForeground" Viewport="0,0,8,22" ViewportUnits="Absolute" Stretch="None" <GeometryGroup>
TileMode="Tile"> <RectangleGeometry Rect="0,0,5.5,22" />
<DrawingBrush.RelativeTransform> </GeometryGroup>
<RotateTransform Angle="2" /> </GeometryDrawing.Geometry>
</DrawingBrush.RelativeTransform> </GeometryDrawing>
<DrawingBrush.Drawing> </DrawingGroup>
<DrawingGroup> </DrawingBrush.Drawing>
<GeometryDrawing Brush="#AAFFCC4C"> </DrawingBrush>
<GeometryDrawing.Geometry> <DrawingBrush
<GeometryGroup> x:Key="WarningProgressBarForeground"
<RectangleGeometry Rect="5.5,0,2.5,22" /> Stretch="None"
</GeometryGroup> TileMode="Tile"
</GeometryDrawing.Geometry> Viewport="0,0,8,22"
</GeometryDrawing> ViewportUnits="Absolute">
<GeometryDrawing Brush="#FFCC4C"> <DrawingBrush.RelativeTransform>
<GeometryDrawing.Geometry> <RotateTransform Angle="2" />
<GeometryGroup> </DrawingBrush.RelativeTransform>
<RectangleGeometry Rect="0,0,5.5,22" /> <DrawingBrush.Drawing>
</GeometryGroup> <DrawingGroup>
</GeometryDrawing.Geometry> <GeometryDrawing Brush="#AAFFCC4C">
</GeometryDrawing> <GeometryDrawing.Geometry>
</DrawingGroup> <GeometryGroup>
</DrawingBrush.Drawing> <RectangleGeometry Rect="5.5,0,2.5,22" />
</DrawingBrush> </GeometryGroup>
<DrawingBrush x:Key="DangerProgressBarForeground" Viewport="0,0,8,22" ViewportUnits="Absolute" Stretch="None" </GeometryDrawing.Geometry>
TileMode="Tile"> </GeometryDrawing>
<DrawingBrush.RelativeTransform> <GeometryDrawing Brush="#FFCC4C">
<RotateTransform Angle="2" /> <GeometryDrawing.Geometry>
</DrawingBrush.RelativeTransform> <GeometryGroup>
<DrawingBrush.Drawing> <RectangleGeometry Rect="0,0,5.5,22" />
<DrawingGroup> </GeometryGroup>
<GeometryDrawing Brush="#AAFF4C4C"> </GeometryDrawing.Geometry>
<GeometryDrawing.Geometry> </GeometryDrawing>
<GeometryGroup> </DrawingGroup>
<RectangleGeometry Rect="5.5,0,2.5,22" /> </DrawingBrush.Drawing>
</GeometryGroup> </DrawingBrush>
</GeometryDrawing.Geometry> <DrawingBrush
</GeometryDrawing> x:Key="DangerProgressBarForeground"
<GeometryDrawing Brush="#FF4C4C"> Stretch="None"
<GeometryDrawing.Geometry> TileMode="Tile"
<GeometryGroup> Viewport="0,0,8,22"
<RectangleGeometry Rect="0,0,5.5,22" /> ViewportUnits="Absolute">
</GeometryGroup> <DrawingBrush.RelativeTransform>
</GeometryDrawing.Geometry> <RotateTransform Angle="2" />
</GeometryDrawing> </DrawingBrush.RelativeTransform>
</DrawingGroup> <DrawingBrush.Drawing>
</DrawingBrush.Drawing> <DrawingGroup>
</DrawingBrush> <GeometryDrawing Brush="#AAFF4C4C">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="5.5,0,2.5,22" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FF4C4C">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,5.5,22" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
<Style x:Key="BaseWindowXStyle" TargetType="pu:WindowX"> <Style x:Key="BaseWindowXStyle" TargetType="pu:WindowX">
<Setter Property="pu:WindowXCaption.Background" Value="{DynamicResource DARKPrimary}" /> <Setter Property="pu:WindowXCaption.Background" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:WindowXCaption.Foreground" Value="{DynamicResource DARKPrimaryText}" /> <Setter Property="pu:WindowXCaption.Foreground" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="pu:WindowXCaption.Buttons" Value="Close" /> <Setter Property="pu:WindowXCaption.Buttons" Value="Close" />
<Setter Property="pu:WindowXCaption.CloseButtonStyle"> <Setter Property="pu:WindowXCaption.CloseButtonStyle">
<Setter.Value> <Setter.Value>
<Style TargetType="Button" BasedOn="{StaticResource {x:Static pu:WindowXCaption.CloseButtonStyleKey}}"> <Style BasedOn="{StaticResource {x:Static pu:WindowXCaption.CloseButtonStyleKey}}" TargetType="Button">
<Setter Property="pu:ButtonHelper.HoverBackground" Value="{x:Null}" /> <Setter Property="pu:ButtonHelper.HoverBackground" Value="{x:Null}" />
</Style> </Style>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<Style x:Key="ThemedButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}"> <Style
<Setter Property="Background" Value="{DynamicResource DARKPrimary}" /> x:Key="ThemedButtonStyle"
<Setter Property="Foreground" Value="{DynamicResource DARKPrimaryText}" /> BasedOn="{StaticResource {x:Type Button}}"
<Setter Property="Padding" Value="10,5" /> TargetType="{x:Type Button}">
<Setter Property="pu:ButtonHelper.CornerRadius" Value="5" /> <Setter Property="Background" Value="{DynamicResource DARKPrimary}" />
</Style> <Setter Property="Foreground" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="Padding" Value="10,5" />
<Setter Property="pu:ButtonHelper.CornerRadius" Value="5" />
</Style>
<Style x:Key="TextButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}"> <Style
<Setter Property="Background" Value="Transparent" /> x:Key="TextButtonStyle"
<Setter Property="Foreground" Value="{DynamicResource PrimaryDarker}" /> BasedOn="{StaticResource {x:Type Button}}"
<Setter Property="Cursor" Value="Hand" /> TargetType="{x:Type Button}">
<Setter Property="Padding" Value="0" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="FontSize" Value="12" /> <Setter Property="Foreground" Value="{DynamicResource PrimaryDarker}" />
</Style> <Setter Property="Cursor" Value="Hand" />
<Setter Property="Padding" Value="0" />
<Setter Property="FontSize" Value="12" />
</Style>
<Style x:Key="DARKPrimaryTextButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource TextButtonStyle}"> <Style
<Setter Property="Foreground" Value="{DynamicResource DARKPrimaryText}" /> x:Key="DARKPrimaryTextButtonStyle"
</Style> BasedOn="{StaticResource TextButtonStyle}"
TargetType="{x:Type Button}">
<Style x:Key="IconInvertedForegroundRepeatButtonStyle" TargetType="{x:Type RepeatButton}" BasedOn="{StaticResource {x:Type RepeatButton}}"> <Setter Property="Foreground" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="Width" Value="25" /> </Style>
<Setter Property="Height" Value="25" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Padding" Value="0" />
<Setter Property="FontSize" Value="15" />
<Setter Property="FontFamily" Value="pack://application:,,,/Res/#remixicon" />
</Style>
<Style x:Key="LinkButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource TextButtonStyle}"> <Style
<Setter Property="ContentTemplate"> x:Key="IconInvertedForegroundRepeatButtonStyle"
<Setter.Value> BasedOn="{StaticResource {x:Type RepeatButton}}"
<DataTemplate> TargetType="{x:Type RepeatButton}">
<TextBlock Text="{Binding}" <Setter Property="Width" Value="25" />
TextDecorations="Underline" /> <Setter Property="Height" Value="25" />
</DataTemplate> <Setter Property="Background" Value="Transparent" />
</Setter.Value> <Setter Property="Foreground" Value="{DynamicResource DARKPrimaryText}" />
</Setter> <Setter Property="Cursor" Value="Hand" />
</Style> <Setter Property="Padding" Value="0" />
<Setter Property="FontSize" Value="15" />
<Setter Property="FontFamily" Value="pack://application:,,,/Res/#remixicon" />
</Style>
<Style x:Key="StndardToggleButtonStyle" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}"> <Style
<Setter Property="Background" Value="{DynamicResource DARKPrimary}" /> x:Key="LinkButtonStyle"
<Setter Property="pu:ToggleButtonHelper.CheckedBackground" Value="{DynamicResource DARKPrimaryDarker}"/> BasedOn="{StaticResource TextButtonStyle}"
<Setter Property="Foreground" Value="{DynamicResource DARKPrimaryText}" /> TargetType="{x:Type Button}">
<Setter Property="Padding" Value="10,5" /> <Setter Property="ContentTemplate">
<Setter Property="pu:ButtonHelper.CornerRadius" Value="5" /> <Setter.Value>
</Style> <DataTemplate>
<TextBlock Text="{Binding}" TextDecorations="Underline" />
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TextToggleButtonStyle" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}"> <Style
<Setter Property="Background" Value="Transparent" /> x:Key="StndardToggleButtonStyle"
<Setter Property="Foreground" Value="{DynamicResource PrimaryDarker}" /> BasedOn="{StaticResource {x:Type ToggleButton}}"
<Setter Property="Cursor" Value="Hand" /> TargetType="{x:Type ToggleButton}">
<Setter Property="Padding" Value="0" /> <Setter Property="Background" Value="{DynamicResource DARKPrimary}" />
<Setter Property="FontSize" Value="14" /> <Setter Property="pu:ToggleButtonHelper.CheckedBackground" Value="{DynamicResource DARKPrimaryDarker}" />
</Style> <Setter Property="Foreground" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="Padding" Value="10,5" />
<Setter Property="pu:ButtonHelper.CornerRadius" Value="5" />
</Style>
<Style x:Key="LinkToggleButtonStyle" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource TextToggleButtonStyle}"> <Style
<Setter Property="ContentTemplate"> x:Key="TextToggleButtonStyle"
<Setter.Value> BasedOn="{StaticResource {x:Type ToggleButton}}"
<DataTemplate> TargetType="{x:Type ToggleButton}">
<TextBlock Text="{Binding}" TextDecorations="Underline" /> <Setter Property="Background" Value="Transparent" />
</DataTemplate> <Setter Property="Foreground" Value="{DynamicResource PrimaryDarker}" />
</Setter.Value> <Setter Property="Cursor" Value="Hand" />
</Setter> <Setter Property="Padding" Value="0" />
</Style> <Setter Property="FontSize" Value="14" />
</Style>
<Style x:Key="StandardPaginationStyle" TargetType="{x:Type pu:Pagination}"> <Style
<Setter Property="Height" Value="25" /> x:Key="LinkToggleButtonStyle"
<Setter Property="ItemsWidth" Value="NaN" /> BasedOn="{StaticResource TextToggleButtonStyle}"
<Setter Property="ItemsPadding" Value="7,0" /> TargetType="{x:Type ToggleButton}">
<Setter Property="ItemsBackground" Value="{DynamicResource DARKPrimaryTrans4}" /> <Setter Property="ContentTemplate">
<Setter Property="ItemsSelectedForeground" Value="{DynamicResource DARKPrimaryText}" /> <Setter.Value>
<Setter Property="ItemsSelectedBackground" Value="{DynamicResource DARKPrimary}" /> <DataTemplate>
<Setter Property="ItemsCornerRadius" Value="2" /> <TextBlock Text="{Binding}" TextDecorations="Underline" />
</Style> </DataTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="StandardComboBoxStyle" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}"> <Style x:Key="StandardPaginationStyle" TargetType="{x:Type pu:Pagination}">
<Setter Property="FontSize" Value="14" /> <Setter Property="Height" Value="25" />
<Setter Property="Height" Value="30" /> <Setter Property="ItemsWidth" Value="NaN" />
<Setter Property="Background" Value="{DynamicResource DARKPrimaryText}" /> <Setter Property="ItemsPadding" Value="7,0" />
<Setter Property="BorderThickness" Value="1.5" /> <Setter Property="ItemsBackground" Value="{DynamicResource DARKPrimaryTrans4}" />
<Setter Property="BorderBrush" Value="{DynamicResource DARKPrimary}" /> <Setter Property="ItemsSelectedForeground" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="Padding" Value="7,0,15,0" /> <Setter Property="ItemsSelectedBackground" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ComboBoxHelper.CornerRadius" Value="5" /> <Setter Property="ItemsCornerRadius" Value="2" />
<Setter Property="pu:ComboBoxHelper.WatermarkForeground" Value="#DCDCDC" /> </Style>
<Setter Property="pu:ComboBoxHelper.ItemsSelectedBackground" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ComboBoxHelper.ItemsSelectedForeground" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="pu:ComboBoxHelper.ItemsHoverBackground" Value="{DynamicResource DARKPrimaryTrans4}" />
<Setter Property="pu:ComboBoxHelper.ItemsPadding" Value="22,0" />
<Setter Property="pu:DropDownHelper.BorderThickness" Value="1" />
<Setter Property="pu:DropDownHelper.Background" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="pu:DropDownHelper.ShadowColor" Value="{DynamicResource ShadowColor}" />
<Setter Property="pu:DropDownHelper.CornerRadius" Value="5" />
<Setter Property="pu:DropDownHelper.MinHeight" Value="100" />
<Setter Property="pu:DropDownHelper.ClipDockSideShadow" Value="False" />
<Setter Property="pu:DropDownHelper.BorderBrush" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ShadowHelper.BlurRadius" Value="15" />
<Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
<Setter Property="pu:ComboBoxHelper.ToggleArrowTransformControlStyle">
<Setter.Value>
<Style TargetType="pu:TransformControl"
BasedOn="{StaticResource {x:Static pu:ComboBoxHelper.ToggleArrowTransformControlStyleKey}}">
<Setter Property="Foreground" Value="{DynamicResource PrimaryText}" />
<Setter Property="FontSize" Value="10" />
<Setter Property="Content" Value="&#xe91f;" />
</Style>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="StandardTextBoxStyle" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="FontSize" Value="14" />
<Setter Property="Height" Value="30" />
<Setter Property="Background" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="BorderThickness" Value="1.5" />
<Setter Property="BorderBrush" Value="{DynamicResource DARKPrimary}" />
<Setter Property="Padding" Value="7,0,15,0" />
<Setter Property="pu:TextBoxHelper.CornerRadius" Value="5" />
<Setter Property="pu:TextBoxHelper.WatermarkForeground" Value="#DCDCDC" />
<Setter Property="pu:ShadowHelper.BlurRadius" Value="15" />
<Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
</Style>
<Style x:Key="StandardSliderStyle" TargetType="Slider" BasedOn="{StaticResource {x:Type Slider}}">
<Setter Property="Background" Value="{DynamicResource DARKPrimaryTrans4}" />
<Setter Property="Foreground" Value="{DynamicResource DARKPrimaryDark}" />
<Setter Property="pu:SliderHelper.ThumbShadowColor" Value="{DynamicResource ShadowColor}" />
<Setter Property="pu:SliderHelper.TrackThickness" Value="2.5" />
<Setter Property="pu:SliderHelper.ThumbBorderBrush" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:SliderHelper.ThumbBorderThickness" Value="2.5" />
<Setter Property="pu:SliderHelper.CoveredBackground" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ShadowHelper.ShadowDepth" Value="3" />
<Setter Property="pu:ShadowHelper.Direction" Value="270" />
<Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
</Style>
<Style x:Key="StandardRadioButtonStyle" TargetType="RadioButton" BasedOn="{StaticResource {x:Type RadioButton}}"> <Style
<Setter Property="pu:RadioButtonHelper.CheckedToggleBrush" Value="{DynamicResource DARKPrimary}" /> x:Key="StandardComboBoxStyle"
<Setter Property="pu:RadioButtonHelper.CheckedBorderBrush" Value="{DynamicResource DARKPrimary}" /> BasedOn="{StaticResource {x:Type ComboBox}}"
</Style> TargetType="{x:Type ComboBox}">
<Setter Property="FontSize" Value="14" />
<Setter Property="Height" Value="30" />
<Setter Property="Background" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="BorderThickness" Value="1.5" />
<Setter Property="BorderBrush" Value="{DynamicResource DARKPrimary}" />
<Setter Property="Padding" Value="7,0,15,0" />
<Setter Property="pu:ComboBoxHelper.CornerRadius" Value="5" />
<Setter Property="pu:ComboBoxHelper.WatermarkForeground" Value="#DCDCDC" />
<Setter Property="pu:ComboBoxHelper.ItemsSelectedBackground" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ComboBoxHelper.ItemsSelectedForeground" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="pu:ComboBoxHelper.ItemsHoverBackground" Value="{DynamicResource DARKPrimaryTrans4}" />
<Setter Property="pu:ComboBoxHelper.ItemsPadding" Value="22,0" />
<Setter Property="pu:DropDownHelper.BorderThickness" Value="1" />
<Setter Property="pu:DropDownHelper.Background" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="pu:DropDownHelper.ShadowColor" Value="{DynamicResource ShadowColor}" />
<Setter Property="pu:DropDownHelper.CornerRadius" Value="5" />
<Setter Property="pu:DropDownHelper.MinHeight" Value="100" />
<Setter Property="pu:DropDownHelper.ClipDockSideShadow" Value="False" />
<Setter Property="pu:DropDownHelper.BorderBrush" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ShadowHelper.BlurRadius" Value="15" />
<Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
<Setter Property="pu:ComboBoxHelper.ToggleArrowTransformControlStyle">
<Setter.Value>
<Style BasedOn="{StaticResource {x:Static pu:ComboBoxHelper.ToggleArrowTransformControlStyleKey}}" TargetType="pu:TransformControl">
<Setter Property="Foreground" Value="{DynamicResource PrimaryText}" />
<Setter Property="FontSize" Value="10" />
<Setter Property="Content" Value="&#xe91f;" />
</Style>
</Setter.Value>
</Setter>
</Style>
<Style
x:Key="StandardTextBoxStyle"
BasedOn="{StaticResource {x:Type TextBox}}"
TargetType="TextBox">
<Setter Property="FontSize" Value="14" />
<Setter Property="Height" Value="30" />
<Setter Property="Background" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="BorderThickness" Value="1.5" />
<Setter Property="BorderBrush" Value="{DynamicResource DARKPrimary}" />
<Setter Property="Padding" Value="7,0,15,0" />
<Setter Property="pu:TextBoxHelper.CornerRadius" Value="5" />
<Setter Property="pu:TextBoxHelper.WatermarkForeground" Value="#DCDCDC" />
<Setter Property="pu:ShadowHelper.BlurRadius" Value="15" />
<Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
</Style>
<Style
x:Key="StandardSliderStyle"
BasedOn="{StaticResource {x:Type Slider}}"
TargetType="Slider">
<Setter Property="Background" Value="{DynamicResource DARKPrimaryTrans4}" />
<Setter Property="Foreground" Value="{DynamicResource DARKPrimaryDark}" />
<Setter Property="pu:SliderHelper.ThumbShadowColor" Value="{DynamicResource ShadowColor}" />
<Setter Property="pu:SliderHelper.TrackThickness" Value="2.5" />
<Setter Property="pu:SliderHelper.ThumbBorderBrush" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:SliderHelper.ThumbBorderThickness" Value="2.5" />
<Setter Property="pu:SliderHelper.CoveredBackground" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ShadowHelper.ShadowDepth" Value="3" />
<Setter Property="pu:ShadowHelper.Direction" Value="270" />
<Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
</Style>
<Style x:Key="SideMenuListBoxStyle" TargetType="ListBox" BasedOn="{StaticResource {x:Type ListBox}}"> <Style
<Setter Property="BorderThickness" Value="0" /> x:Key="StandardRadioButtonStyle"
<Setter Property="Background" Value="Transparent" /> BasedOn="{StaticResource {x:Type RadioButton}}"
<Setter Property="pu:ListBoxHelper.ItemsHeight" Value="30" /> TargetType="RadioButton">
<Setter Property="pu:ListBoxHelper.ItemsPadding" Value="15,0" /> <Setter Property="pu:RadioButtonHelper.CheckedToggleBrush" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ListBoxHelper.ItemsCornerRadius" Value="5" /> <Setter Property="pu:RadioButtonHelper.CheckedBorderBrush" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ListBoxHelper.ItemsHoverBackground" Value="{x:Null}" /> </Style>
<Setter Property="pu:ListBoxHelper.ItemsSelectedBackground" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ListBoxHelper.ItemsSelectedForeground" Value="{DynamicResource DARKPrimaryText}" />
</Style>
<Style x:Key="ToolBarMenuStyle" TargetType="Menu" BasedOn="{StaticResource {x:Type Menu}}"> <Style
<Setter Property="Height" Value="55" /> x:Key="SideMenuListBoxStyle"
<Setter Property="FontSize" Value="24" /> BasedOn="{StaticResource {x:Type ListBox}}"
<Setter Property="VerticalContentAlignment" Value="Center" /> TargetType="ListBox">
<Setter Property="pu:MenuHelper.TopLevelDropDownVerticalOffset" Value="-25" /> <Setter Property="BorderThickness" Value="0" />
<Setter Property="BorderBrush" Value="{DynamicResource DARKPrimaryDarker}" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="Background" Value="{DynamicResource DARKPrimaryText}" /> <Setter Property="pu:ListBoxHelper.ItemsHeight" Value="30" />
<Setter Property="pu:MenuHelper.CornerRadius" Value="5" /> <Setter Property="pu:ListBoxHelper.ItemsPadding" Value="15,0" />
<Setter Property="pu:MenuHelper.TopLevelDropDownPlacement" Value="TopRight" /> <Setter Property="pu:ListBoxHelper.ItemsCornerRadius" Value="5" />
<Setter Property="pu:MenuHelper.TopLevelItemsPadding" Value="15,0" /> <Setter Property="pu:ListBoxHelper.ItemsHoverBackground" Value="{x:Null}" />
<Setter Property="pu:MenuHelper.TopLevelItemsHeight" Value="55" /> <Setter Property="pu:ListBoxHelper.ItemsSelectedBackground" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:MenuHelper.TopLevelItemsBackground" Value="Transparent" /> <Setter Property="pu:ListBoxHelper.ItemsSelectedForeground" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="pu:MenuHelper.TopLevelItemsHoverBackground" Value="{DynamicResource SecondaryLighter}" /> </Style>
<Setter Property="pu:MenuHelper.TopLevelItemsHoverForeground" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:MenuHelper.TopLevelItemsOpenedBackground" Value="{DynamicResource SecondaryLighter}" /> <Style
<Setter Property="pu:MenuHelper.TopLevelItemsOpenedForeground" Value="{DynamicResource DARKPrimary}" /> x:Key="ToolBarMenuStyle"
<Setter Property="pu:MenuHelper.SubmenuItemsPadding" Value="15,0" /> BasedOn="{StaticResource {x:Type Menu}}"
<Setter Property="pu:MenuHelper.SubmenuItemsHeight" Value="55" /> TargetType="Menu">
<Setter Property="pu:MenuHelper.SubmenuItemsIconWidth" Value="NaN" /> <Setter Property="Height" Value="55" />
<Setter Property="pu:MenuHelper.SubmenuItemsWidth" Value="200" /> <Setter Property="FontSize" Value="24" />
<Setter Property="pu:DropDownHelper.CornerRadius" Value="5" /> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="pu:MenuHelper.SubmenuItemsBackground" Value="Transparent" /> <Setter Property="pu:MenuHelper.TopLevelDropDownVerticalOffset" Value="-25" />
<Setter Property="pu:MenuHelper.SubmenuItemsHoverBackground" Value="{DynamicResource SecondaryLighter}" /> <Setter Property="BorderBrush" Value="{DynamicResource DARKPrimaryDarker}" />
<!--<Setter Property="pu:MenuHelper.SubmenuItemsHoverForeground" <Setter Property="Background" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="pu:MenuHelper.CornerRadius" Value="5" />
<Setter Property="pu:MenuHelper.TopLevelDropDownPlacement" Value="TopRight" />
<Setter Property="pu:MenuHelper.TopLevelItemsPadding" Value="15,0" />
<Setter Property="pu:MenuHelper.TopLevelItemsHeight" Value="55" />
<Setter Property="pu:MenuHelper.TopLevelItemsBackground" Value="Transparent" />
<Setter Property="pu:MenuHelper.TopLevelItemsHoverBackground" Value="{DynamicResource SecondaryLighter}" />
<Setter Property="pu:MenuHelper.TopLevelItemsHoverForeground" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:MenuHelper.TopLevelItemsOpenedBackground" Value="{DynamicResource SecondaryLighter}" />
<Setter Property="pu:MenuHelper.TopLevelItemsOpenedForeground" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:MenuHelper.SubmenuItemsPadding" Value="15,0" />
<Setter Property="pu:MenuHelper.SubmenuItemsHeight" Value="55" />
<Setter Property="pu:MenuHelper.SubmenuItemsIconWidth" Value="NaN" />
<Setter Property="pu:MenuHelper.SubmenuItemsWidth" Value="200" />
<Setter Property="pu:DropDownHelper.CornerRadius" Value="5" />
<Setter Property="pu:MenuHelper.SubmenuItemsBackground" Value="Transparent" />
<Setter Property="pu:MenuHelper.SubmenuItemsHoverBackground" Value="{DynamicResource SecondaryLighter}" />
<!--<Setter Property="pu:MenuHelper.SubmenuItemsHoverForeground"
Value="{DynamicResource DARKPrimary}" />--> Value="{DynamicResource DARKPrimary}" />-->
<Setter Property="pu:MenuHelper.SubmenuItemsOpenedBackground" Value="{DynamicResource SecondaryLighter}" /> <Setter Property="pu:MenuHelper.SubmenuItemsOpenedBackground" Value="{DynamicResource SecondaryLighter}" />
<!--<Setter Property="pu:MenuHelper.SubmenuItemsOpenedForeground" <!--<Setter Property="pu:MenuHelper.SubmenuItemsOpenedForeground"
Value="{DynamicResource DARKPrimary}" />--> Value="{DynamicResource DARKPrimary}" />-->
<Setter Property="pu:MenuHelper.SubmenuItemsSeparatorVisibility" Value="Visible" /> <Setter Property="pu:MenuHelper.SubmenuItemsSeparatorVisibility" Value="Visible" />
<Setter Property="pu:MenuHelper.SubmenuItemsSeparatorBrush" Value="#CCCECF" /> <Setter Property="pu:MenuHelper.SubmenuItemsSeparatorBrush" Value="#CCCECF" />
<Setter Property="pu:MenuHelper.SubmenuItemsSeparatorMargin" Value="10,0" /> <Setter Property="pu:MenuHelper.SubmenuItemsSeparatorMargin" Value="10,0" />
<!--<Setter Property="pu:MenuHelper.ShadowColor" <!--<Setter Property="pu:MenuHelper.ShadowColor"
Value="{DynamicResource ShadowColor}" />--> Value="{DynamicResource ShadowColor}" />-->
<Setter Property="pu:DropDownHelper.ShadowColor" Value="{DynamicResource ShadowColor}" /> <Setter Property="pu:DropDownHelper.ShadowColor" Value="{DynamicResource ShadowColor}" />
<Setter Property="pu:ShadowHelper.Opacity" Value="0.7" /> <Setter Property="pu:ShadowHelper.Opacity" Value="0.7" />
<Setter Property="pu:ShadowHelper.BlurRadius" Value="25" /> <Setter Property="pu:ShadowHelper.BlurRadius" Value="25" />
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>

View File

@ -1,212 +1,139 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <ResourceDictionary
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:pucore="clr-namespace:Panuon.WPF;assembly=Panuon.WPF"> xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI"
<ResourceDictionary.MergedDictionaries> xmlns:pucore="clr-namespace:Panuon.WPF;assembly=Panuon.WPF">
<ResourceDictionary Source="/VPet-Simulator.Core;component/Display/Theme.xaml"/> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VPet-Simulator.Core;component/Display/basestyle.xaml"/> <ResourceDictionary Source="/VPet-Simulator.Core;component/Display/Theme.xaml" />
</ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/VPet-Simulator.Core;component/Display/basestyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="BaseWindowXStyle" <Style x:Key="BaseWindowXStyle" TargetType="pu:WindowX">
TargetType="pu:WindowX"> <Setter Property="pu:WindowXCaption.Background" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:WindowXCaption.Background" <Setter Property="pu:WindowXCaption.Foreground" Value="{DynamicResource DARKPrimaryText}" />
Value="{DynamicResource DARKPrimary}" /> <Setter Property="pu:WindowXCaption.Buttons" Value="Close" />
<Setter Property="pu:WindowXCaption.Foreground" <Setter Property="pu:WindowXCaption.CloseButtonStyle">
Value="{DynamicResource DARKPrimaryText}" /> <Setter.Value>
<Setter Property="pu:WindowXCaption.Buttons" <Style BasedOn="{StaticResource {x:Static pu:WindowXCaption.CloseButtonStyleKey}}" TargetType="Button">
Value="Close" /> <Setter Property="pu:ButtonHelper.HoverBackground" Value="{x:Null}" />
<Setter Property="pu:WindowXCaption.CloseButtonStyle"> </Style>
<Setter.Value> </Setter.Value>
<Style TargetType="Button" </Setter>
BasedOn="{StaticResource {x:Static pu:WindowXCaption.CloseButtonStyleKey}}"> </Style>
<Setter Property="pu:ButtonHelper.HoverBackground"
Value="{x:Null}" />
</Style>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="StandardComboBoxStyle"
TargetType="{x:Type ComboBox}"
BasedOn="{StaticResource {x:Type ComboBox}}">
<Setter Property="FontSize"
Value="14" />
<Setter Property="Height"
Value="30" />
<Setter Property="Background"
Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="BorderThickness"
Value="1.5" />
<Setter Property="BorderBrush"
Value="{DynamicResource DARKPrimary}" />
<Setter Property="Padding"
Value="7,0,15,0" />
<Setter Property="pu:ComboBoxHelper.CornerRadius"
Value="5" />
<Setter Property="pu:ComboBoxHelper.WatermarkForeground"
Value="#DCDCDC" />
<Setter Property="pu:ComboBoxHelper.ItemsSelectedBackground"
Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ComboBoxHelper.ItemsSelectedForeground"
Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="pu:ComboBoxHelper.ItemsHoverBackground"
Value="{DynamicResource DARKPrimaryTrans4}" />
<Setter Property="pu:ComboBoxHelper.ItemsPadding"
Value="22,0" />
<Setter Property="pu:DropDownHelper.BorderThickness"
Value="1" />
<Setter Property="pu:DropDownHelper.Background"
Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="pu:DropDownHelper.ShadowColor"
Value="{DynamicResource ShadowColor}" />
<Setter Property="pu:DropDownHelper.CornerRadius"
Value="5" />
<Setter Property="pu:DropDownHelper.MinHeight"
Value="100" />
<Setter Property="pu:DropDownHelper.ClipDockSideShadow"
Value="False" />
<Setter Property="pu:DropDownHelper.BorderBrush"
Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ShadowHelper.BlurRadius"
Value="15" />
<Setter Property="pu:ShadowHelper.Opacity"
Value="0.5" />
<Setter Property="pu:ComboBoxHelper.ToggleArrowTransformControlStyle">
<Setter.Value>
<Style TargetType="pu:TransformControl"
BasedOn="{StaticResource {x:Static pu:ComboBoxHelper.ToggleArrowTransformControlStyleKey}}">
<Setter Property="Foreground"
Value="{DynamicResource PrimaryText}" />
<Setter Property="FontSize"
Value="10" />
<Setter Property="Content"
Value="&#xe91f;" />
</Style>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="StandardSliderStyle"
TargetType="Slider"
BasedOn="{StaticResource {x:Type Slider}}">
<Setter Property="Background"
Value="{DynamicResource DARKPrimaryTrans4}" />
<Setter Property="Foreground"
Value="{DynamicResource DARKPrimaryDark}" />
<Setter Property="pu:SliderHelper.ThumbShadowColor"
Value="{DynamicResource ShadowColor}" />
<Setter Property="pu:SliderHelper.TrackThickness"
Value="2.5" />
<Setter Property="pu:SliderHelper.ThumbBorderBrush"
Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:SliderHelper.ThumbBorderThickness"
Value="2.5" />
<Setter Property="pu:SliderHelper.CoveredBackground"
Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ShadowHelper.ShadowDepth"
Value="3" />
<Setter Property="pu:ShadowHelper.Direction"
Value="270" />
<Setter Property="pu:ShadowHelper.Opacity"
Value="0.5" />
</Style>
<Style x:Key="StandardRadioButtonStyle" <Style
TargetType="RadioButton" x:Key="StandardComboBoxStyle"
BasedOn="{StaticResource {x:Type RadioButton}}"> BasedOn="{StaticResource {x:Type ComboBox}}"
<Setter Property="pu:RadioButtonHelper.CheckedToggleBrush" TargetType="{x:Type ComboBox}">
Value="{DynamicResource DARKPrimary}" /> <Setter Property="FontSize" Value="14" />
<Setter Property="pu:RadioButtonHelper.CheckedBorderBrush" <Setter Property="Height" Value="30" />
Value="{DynamicResource DARKPrimary}" /> <Setter Property="Background" Value="{DynamicResource DARKPrimaryText}" />
</Style> <Setter Property="BorderThickness" Value="1.5" />
<Setter Property="BorderBrush" Value="{DynamicResource DARKPrimary}" />
<Setter Property="Padding" Value="7,0,15,0" />
<Setter Property="pu:ComboBoxHelper.CornerRadius" Value="5" />
<Setter Property="pu:ComboBoxHelper.WatermarkForeground" Value="#DCDCDC" />
<Setter Property="pu:ComboBoxHelper.ItemsSelectedBackground" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ComboBoxHelper.ItemsSelectedForeground" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="pu:ComboBoxHelper.ItemsHoverBackground" Value="{DynamicResource DARKPrimaryTrans4}" />
<Setter Property="pu:ComboBoxHelper.ItemsPadding" Value="22,0" />
<Setter Property="pu:DropDownHelper.BorderThickness" Value="1" />
<Setter Property="pu:DropDownHelper.Background" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="pu:DropDownHelper.ShadowColor" Value="{DynamicResource ShadowColor}" />
<Setter Property="pu:DropDownHelper.CornerRadius" Value="5" />
<Setter Property="pu:DropDownHelper.MinHeight" Value="100" />
<Setter Property="pu:DropDownHelper.ClipDockSideShadow" Value="False" />
<Setter Property="pu:DropDownHelper.BorderBrush" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ShadowHelper.BlurRadius" Value="15" />
<Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
<Setter Property="pu:ComboBoxHelper.ToggleArrowTransformControlStyle">
<Setter.Value>
<Style BasedOn="{StaticResource {x:Static pu:ComboBoxHelper.ToggleArrowTransformControlStyleKey}}" TargetType="pu:TransformControl">
<Setter Property="Foreground" Value="{DynamicResource PrimaryText}" />
<Setter Property="FontSize" Value="10" />
<Setter Property="Content" Value="&#xe91f;" />
</Style>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SideMenuListBoxStyle" <Style
TargetType="ListBox" x:Key="StandardSliderStyle"
BasedOn="{StaticResource {x:Type ListBox}}"> BasedOn="{StaticResource {x:Type Slider}}"
<Setter Property="BorderThickness" TargetType="Slider">
Value="0" /> <Setter Property="Background" Value="{DynamicResource DARKPrimaryTrans4}" />
<Setter Property="Background" <Setter Property="Foreground" Value="{DynamicResource DARKPrimaryDark}" />
Value="Transparent" /> <Setter Property="pu:SliderHelper.ThumbShadowColor" Value="{DynamicResource ShadowColor}" />
<Setter Property="pu:ListBoxHelper.ItemsHeight" <Setter Property="pu:SliderHelper.TrackThickness" Value="2.5" />
Value="30" /> <Setter Property="pu:SliderHelper.ThumbBorderBrush" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ListBoxHelper.ItemsPadding" <Setter Property="pu:SliderHelper.ThumbBorderThickness" Value="2.5" />
Value="15,0" /> <Setter Property="pu:SliderHelper.CoveredBackground" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:ListBoxHelper.ItemsCornerRadius" <Setter Property="pu:ShadowHelper.ShadowDepth" Value="3" />
Value="5" /> <Setter Property="pu:ShadowHelper.Direction" Value="270" />
<Setter Property="pu:ListBoxHelper.ItemsHoverBackground" <Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
Value="{x:Null}" /> </Style>
<Setter Property="pu:ListBoxHelper.ItemsSelectedBackground"
Value="{DynamicResource DARKPrimary}" /> <Style
<Setter Property="pu:ListBoxHelper.ItemsSelectedForeground" x:Key="StandardRadioButtonStyle"
Value="{DynamicResource DARKPrimaryText}" /> BasedOn="{StaticResource {x:Type RadioButton}}"
</Style> TargetType="RadioButton">
<Setter Property="pu:RadioButtonHelper.CheckedToggleBrush" Value="{DynamicResource DARKPrimary}" />
<Style x:Key="ToolBarMenuStyle" <Setter Property="pu:RadioButtonHelper.CheckedBorderBrush" Value="{DynamicResource DARKPrimary}" />
TargetType="Menu" </Style>
BasedOn="{StaticResource {x:Type Menu}}">
<Setter Property="Height" <Style
Value="55" /> x:Key="SideMenuListBoxStyle"
<Setter Property="FontSize" BasedOn="{StaticResource {x:Type ListBox}}"
Value="24" /> TargetType="ListBox">
<Setter Property="VerticalContentAlignment" <Setter Property="BorderThickness" Value="0" />
Value="Center" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="pu:MenuHelper.TopLevelDropDownVerticalOffset" <Setter Property="pu:ListBoxHelper.ItemsHeight" Value="30" />
Value="-25" /> <Setter Property="pu:ListBoxHelper.ItemsPadding" Value="15,0" />
<Setter Property="BorderBrush" <Setter Property="pu:ListBoxHelper.ItemsCornerRadius" Value="5" />
Value="{DynamicResource DARKPrimaryDarker}" /> <Setter Property="pu:ListBoxHelper.ItemsHoverBackground" Value="{x:Null}" />
<Setter Property="Background" <Setter Property="pu:ListBoxHelper.ItemsSelectedBackground" Value="{DynamicResource DARKPrimary}" />
Value="{DynamicResource DARKPrimaryText}" /> <Setter Property="pu:ListBoxHelper.ItemsSelectedForeground" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="pu:MenuHelper.CornerRadius" </Style>
Value="5" />
<Setter Property="pu:MenuHelper.TopLevelDropDownPlacement" <Style
Value="TopRight" /> x:Key="ToolBarMenuStyle"
<Setter Property="pu:MenuHelper.TopLevelItemsPadding" BasedOn="{StaticResource {x:Type Menu}}"
Value="15,0" /> TargetType="Menu">
<Setter Property="pu:MenuHelper.TopLevelItemsBackground" <Setter Property="Height" Value="55" />
Value="Transparent" /> <Setter Property="FontSize" Value="24" />
<Setter Property="pu:MenuHelper.TopLevelItemsHoverBackground" <Setter Property="VerticalContentAlignment" Value="Center" />
Value="{DynamicResource SecondaryLighter}" /> <Setter Property="pu:MenuHelper.TopLevelDropDownVerticalOffset" Value="-25" />
<Setter Property="pu:MenuHelper.TopLevelItemsHoverForeground" <Setter Property="BorderBrush" Value="{DynamicResource DARKPrimaryDarker}" />
Value="{DynamicResource DARKPrimary}" /> <Setter Property="Background" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="pu:MenuHelper.TopLevelItemsOpenedBackground" <Setter Property="pu:MenuHelper.CornerRadius" Value="5" />
Value="{DynamicResource SecondaryLighter}" /> <Setter Property="pu:MenuHelper.TopLevelDropDownPlacement" Value="TopRight" />
<Setter Property="pu:MenuHelper.TopLevelItemsOpenedForeground" <Setter Property="pu:MenuHelper.TopLevelItemsPadding" Value="15,0" />
Value="{DynamicResource DARKPrimary}" /> <Setter Property="pu:MenuHelper.TopLevelItemsBackground" Value="Transparent" />
<Setter Property="pu:MenuHelper.SubmenuItemsPadding" <Setter Property="pu:MenuHelper.TopLevelItemsHoverBackground" Value="{DynamicResource SecondaryLighter}" />
Value="15,0" /> <Setter Property="pu:MenuHelper.TopLevelItemsHoverForeground" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:MenuHelper.SubmenuItemsHeight" <Setter Property="pu:MenuHelper.TopLevelItemsOpenedBackground" Value="{DynamicResource SecondaryLighter}" />
Value="55" /> <Setter Property="pu:MenuHelper.TopLevelItemsOpenedForeground" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:MenuHelper.SubmenuItemsIconWidth" <Setter Property="pu:MenuHelper.SubmenuItemsPadding" Value="15,0" />
Value="NaN" /> <Setter Property="pu:MenuHelper.SubmenuItemsHeight" Value="55" />
<Setter Property="pu:MenuHelper.SubmenuItemsWidth" <Setter Property="pu:MenuHelper.SubmenuItemsIconWidth" Value="NaN" />
Value="200" /> <Setter Property="pu:MenuHelper.SubmenuItemsWidth" Value="200" />
<Setter Property="pu:DropDownHelper.CornerRadius" <Setter Property="pu:DropDownHelper.CornerRadius" Value="5" />
Value="5" /> <Setter Property="pu:MenuHelper.SubmenuItemsBackground" Value="Transparent" />
<Setter Property="pu:MenuHelper.SubmenuItemsBackground" <Setter Property="pu:MenuHelper.SubmenuItemsHoverBackground" Value="{DynamicResource SecondaryLighter}" />
Value="Transparent" /> <!--<Setter Property="pu:MenuHelper.SubmenuItemsHoverForeground"
<Setter Property="pu:MenuHelper.SubmenuItemsHoverBackground"
Value="{DynamicResource SecondaryLighter}" />
<!--<Setter Property="pu:MenuHelper.SubmenuItemsHoverForeground"
Value="{DynamicResource DARKPrimary}" />--> Value="{DynamicResource DARKPrimary}" />-->
<Setter Property="pu:MenuHelper.SubmenuItemsOpenedBackground" <Setter Property="pu:MenuHelper.SubmenuItemsOpenedBackground" Value="{DynamicResource SecondaryLighter}" />
Value="{DynamicResource SecondaryLighter}" /> <!--<Setter Property="pu:MenuHelper.SubmenuItemsOpenedForeground"
<!--<Setter Property="pu:MenuHelper.SubmenuItemsOpenedForeground"
Value="{DynamicResource DARKPrimary}" />--> Value="{DynamicResource DARKPrimary}" />-->
<Setter Property="pu:MenuHelper.SubmenuItemsSeparatorVisibility" <Setter Property="pu:MenuHelper.SubmenuItemsSeparatorVisibility" Value="Visible" />
Value="Visible" /> <Setter Property="pu:MenuHelper.SubmenuItemsSeparatorBrush" Value="#CCCECF" />
<Setter Property="pu:MenuHelper.SubmenuItemsSeparatorBrush" <Setter Property="pu:MenuHelper.SubmenuItemsSeparatorMargin" Value="10,0" />
Value="#CCCECF" /> <!--<Setter Property="pu:MenuHelper.ShadowColor"
<Setter Property="pu:MenuHelper.SubmenuItemsSeparatorMargin"
Value="10,0" />
<!--<Setter Property="pu:MenuHelper.ShadowColor"
Value="{DynamicResource ShadowColor}" />--> Value="{DynamicResource ShadowColor}" />-->
<Setter Property="pu:DropDownHelper.ShadowColor" <Setter Property="pu:DropDownHelper.ShadowColor" Value="{DynamicResource ShadowColor}" />
Value="{DynamicResource ShadowColor}" /> <Setter Property="pu:ShadowHelper.Opacity" Value="0.7" />
<Setter Property="pu:ShadowHelper.Opacity" <Setter Property="pu:ShadowHelper.BlurRadius" Value="25" />
Value="0.7" /> </Style>
<Setter Property="pu:ShadowHelper.BlurRadius"
Value="25" />
</Style>
</ResourceDictionary> </ResourceDictionary>

View File

@ -1,29 +1,31 @@
<Application x:Class="VPet_Simulator.Windows.App" <Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x:Class="VPet_Simulator.Windows.App"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="clr-namespace:VPet_Simulator.Windows" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:pu="https://opensource.panuon.com/wpf-ui" xmlns:local="clr-namespace:VPet_Simulator.Windows"
StartupUri="MainWindow.xaml"> xmlns:pu="https://opensource.panuon.com/wpf-ui"
<Application.Resources> StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VPet-Simulator.Windows.Interface;component/ResourceStyle.xaml" />
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <FontFamily x:Key="MainFont">
<ResourceDictionary Source="/VPet-Simulator.Windows.Interface;component/ResourceStyle.xaml" /> /VPet-Simulator.Windows;component/Res/Font/#OPPOSans R
<ResourceDictionary> </FontFamily>
<FontFamily x:Key="MainFont"> <FontFamily x:Key="RemixIcon">
/VPet-Simulator.Windows;component/Res/Font/#OPPOSans R /VPet-Simulator.Windows;component/Res/#remixicon
</FontFamily> </FontFamily>
<FontFamily x:Key="RemixIcon">
/VPet-Simulator.Windows;component/Res/#remixicon
</FontFamily>
</ResourceDictionary>
<ResourceDictionary>
<pu:GlobalSettings x:Key="globalSettings"
FontFamily="{StaticResource MainFont}"
FontSize="14"
IconFontFamily="/VPet-Simulator.Windows;component/Res/#remixicon"
IconFontSize="16" />
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Application.Resources> <ResourceDictionary>
<pu:GlobalSettings
x:Key="globalSettings"
FontFamily="{StaticResource MainFont}"
FontSize="14"
IconFontFamily="/VPet-Simulator.Windows;component/Res/#remixicon"
IconFontSize="16" />
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application> </Application>

View File

@ -1,16 +1,15 @@
<ResourceDictionary <ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="clr-namespace:VPet.House.Converters"> xmlns:c="clr-namespace:HKW.WPF.Converters">
<c:MarginConverter x:Key="MarginConverter" /> <c:MarginConverter x:Key="MarginConverter" />
<c:RatioMarginConverter x:Key="RatioMarginConverter" /> <c:MarginConverter x:Key="RatioMarginConverter" HaveRatio="True" />
<c:CalculatorConverter x:Key="CalculatorConverter" /> <c:CalculatorConverter x:Key="CalculatorConverter" />
<c:StringFormatConverter x:Key="StringFormatConverter" /> <c:StringFormatConverter x:Key="StringFormatConverter" />
<c:BrushToMediaColorConverter x:Key="BrushToMediaColorConverter" /> <c:BrushToMediaColorConverter x:Key="BrushToMediaColorConverter" />
<c:MaxConverter x:Key="MaxConverter" /> <c:BoolToVisibilityConverter x:Key="FalseToHiddenConverter" />
<c:FalseToHiddenConverter x:Key="FalseToHiddenConverter" />
<c:EqualsConverter x:Key="EqualsConverter" /> <c:EqualsConverter x:Key="EqualsConverter" />
<c:NotEqualsConverter x:Key="NotEqualsConverter" /> <c:EqualsConverter x:Key="NotEqualsConverter" Inverter="True" />
<c:NullToFalseConverter x:Key="NullToFalseConverter" /> <c:ValueToBoolConverter x:Key="NullToFalse" />
<c:BoolInverter x:Key="BoolInverter" /> <c:BoolInverter x:Key="BoolInverter" />
</ResourceDictionary> </ResourceDictionary>

View File

@ -0,0 +1,52 @@
using System.ComponentModel;
using System.Globalization;
using System.Windows;
namespace HKW.WPF.Converters;
/// <summary>
/// 全部为布尔值转换器
/// </summary>
public class AllIsBoolConverter : MultiValueToBoolConverter<AllIsBoolConverter>
{
/// <summary>
///
/// </summary>
public static readonly DependencyProperty BoolOnNullProperty = DependencyProperty.Register(
nameof(BoolOnNull),
typeof(bool),
typeof(AllIsBoolConverter),
new PropertyMetadata(false)
);
/// <summary>
/// 目标为空时的指定值
/// </summary>
[DefaultValue(false)]
public bool BoolOnNull
{
get => (bool)GetValue(BoolOnNullProperty);
set => SetValue(BoolOnNullProperty, value);
}
/// <summary>
///
/// </summary>
/// <param name="values"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public override object Convert(
object[] values,
Type targetType,
object parameter,
CultureInfo culture
)
{
var boolValue = TargetBoolValue;
var nullValue = BoolOnNull;
return values.All(o => Utils.GetBool(o, boolValue, nullValue));
}
}

View File

@ -0,0 +1,97 @@
using System.ComponentModel;
using System.Globalization;
using System.Windows;
namespace HKW.WPF.Converters;
/// <summary>
/// 全部为布尔值转换器
/// </summary>
public class AllIsBoolToVisibilityConverter
: MultiValueToBoolConverter<AllIsBoolToVisibilityConverter>
{
/// <summary>
///
/// </summary>
public static readonly DependencyProperty BoolOnNullProperty = DependencyProperty.Register(
nameof(BoolOnNull),
typeof(bool),
typeof(AllIsBoolToVisibilityConverter),
new PropertyMetadata(false)
);
/// <summary>
/// 目标为空时的指定值
/// </summary>
[DefaultValue(false)]
public bool BoolOnNull
{
get => (bool)GetValue(BoolOnNullProperty);
set => SetValue(BoolOnNullProperty, value);
}
/// <summary>
///
/// </summary>
public static readonly DependencyProperty VisibilityOnTrueProperty =
DependencyProperty.Register(
nameof(VisibilityOnTrue),
typeof(Visibility),
typeof(AllIsBoolToVisibilityConverter),
new PropertyMetadata(Visibility.Visible)
);
/// <summary>
/// 目标为空时的指定值
/// </summary>
[DefaultValue(Visibility.Visible)]
public Visibility VisibilityOnTrue
{
get => (Visibility)GetValue(TargetBoolValueProperty);
set => SetValue(TargetBoolValueProperty, value);
}
/// <summary>
///
/// </summary>
public static readonly DependencyProperty VisibilityOnFalseProperty =
DependencyProperty.Register(
nameof(VisibilityOnFalse),
typeof(Visibility),
typeof(AllIsBoolToVisibilityConverter),
new PropertyMetadata(Visibility.Hidden)
);
/// <summary>
/// 目标为空时的指定值
/// </summary>
[DefaultValue(Visibility.Hidden)]
public Visibility VisibilityOnFalse
{
get => (Visibility)GetValue(TargetBoolValueProperty);
set => SetValue(TargetBoolValueProperty, value);
}
/// <summary>
///
/// </summary>
/// <param name="values"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public override object Convert(
object[] values,
Type targetType,
object parameter,
CultureInfo culture
)
{
var boolValue = TargetBoolValue;
var nullValue = BoolOnNull;
return values.All(o => Utils.GetBool(o, boolValue, nullValue))
? VisibilityOnTrue
: VisibilityOnFalse;
}
}

View File

@ -1,19 +1,41 @@
using System.Globalization; using System.ComponentModel;
using System.Globalization;
using System.Windows;
using System.Windows.Data; using System.Windows.Data;
namespace VPet.House.Converters; namespace HKW.WPF.Converters;
public class BoolInverter : IValueConverter public class BoolInverter : ValueConverterBase
{ {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) /// <summary>
///
/// </summary>
public static readonly DependencyProperty NullValueProperty = DependencyProperty.Register(
nameof(NullValue),
typeof(bool),
typeof(AllIsBoolToVisibilityConverter),
new PropertyMetadata(false)
);
/// <summary>
/// 为空值时布尔值
/// </summary>
[DefaultValue(false)]
public bool NullValue
{
get => (bool)GetValue(NullValueProperty);
set => SetValue(NullValueProperty, value);
}
public override object Convert(
object value,
Type targetType,
object parameter,
CultureInfo culture
)
{ {
if (value is not bool b) if (value is not bool b)
return false; return NullValue;
return !b; return !b;
} }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
} }

View File

@ -0,0 +1,63 @@
using System.ComponentModel;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace HKW.WPF.Converters;
public class BoolToVisibilityConverter : BoolToValueConverterBase<BoolToVisibilityConverter>
{
/// <summary>
///
/// </summary>
public static readonly DependencyProperty TrueVisibilityValueProperty =
DependencyProperty.Register(
nameof(TrueVisibilityValue),
typeof(Visibility),
typeof(AllIsBoolToVisibilityConverter),
new PropertyMetadata(Visibility.Visible)
);
/// <summary>
/// 为真时的可见度
/// </summary>
[DefaultValue(Visibility.Visible)]
public Visibility TrueVisibilityValue
{
get => (Visibility)GetValue(TrueVisibilityValueProperty);
set => SetValue(TrueVisibilityValueProperty, value);
}
/// <summary>
///
/// </summary>
public static readonly DependencyProperty FalseVisibilityValueProperty =
DependencyProperty.Register(
nameof(FalseVisibilityValue),
typeof(Visibility),
typeof(AllIsBoolToVisibilityConverter),
new PropertyMetadata(Visibility.Hidden)
);
/// <summary>
/// 为假时的可见度
/// </summary>
[DefaultValue(Visibility.Hidden)]
public Visibility FalseVisibilityValue
{
get => (Visibility)GetValue(FalseVisibilityValueProperty);
set => SetValue(FalseVisibilityValueProperty, value);
}
public override object Convert(
object value,
Type targetType,
object parameter,
CultureInfo culture
)
{
return Utils.GetBool(value, BoolValue, NullValue)
? TrueVisibilityValue
: FalseVisibilityValue;
}
}

View File

@ -1,22 +1,39 @@
using System.Globalization; using System.Globalization;
using System.Windows.Data;
using System.Windows.Media; using System.Windows.Media;
namespace VPet.House.Converters; namespace HKW.WPF.Converters;
public class BrushToMediaColorConverter : IValueConverter /// <summary>
/// 画笔颜色至媒体颜色转换器
/// </summary>
public class BrushToMediaColorConverter : ValueConverterBase
{ {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) /// <inheritdoc/>
public override object Convert(
object value,
Type targetType,
object parameter,
CultureInfo culture
)
{ {
if (value is not SolidColorBrush brush) if (value is not SolidColorBrush brush)
throw new ArgumentException("Not SolidColorBrush", nameof(value)); throw new ArgumentException(
$"Not type: {typeof(SolidColorBrush).FullName}",
nameof(value)
);
return brush.Color; return brush.Color;
} }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) /// <inheritdoc/>
public override object ConvertBack(
object value,
Type targetType,
object parameter,
CultureInfo culture
)
{ {
if (value is not Color color) if (value is not Color color)
throw new ArgumentException("Not media color", nameof(value)); throw new ArgumentException($"Not type: {typeof(Color).FullName}", nameof(value));
return new SolidColorBrush(color); return new SolidColorBrush(color);
} }
} }

View File

@ -1,8 +1,7 @@
using System.Globalization; using System.Globalization;
using System.Windows; using System.Windows;
using System.Windows.Data;
namespace VPet.House.Converters; namespace HKW.WPF.Converters;
/// <summary> /// <summary>
/// 计算器转换器 /// 计算器转换器
@ -30,9 +29,15 @@ namespace VPet.House.Converters;
/// ]]></code></para> /// ]]></code></para>
/// </summary> /// </summary>
/// <exception cref="Exception">绑定的数量不正确</exception> /// <exception cref="Exception">绑定的数量不正确</exception>
public class CalculatorConverter : IMultiValueConverter public class CalculatorConverter : MultiValueConverterBase
{ {
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) /// <inheritdoc/>
public override object Convert(
object[] values,
Type targetType,
object parameter,
CultureInfo culture
)
{ {
if (values.Any(i => i == DependencyProperty.UnsetValue)) if (values.Any(i => i == DependencyProperty.UnsetValue))
return 0.0; return 0.0;
@ -72,6 +77,14 @@ public class CalculatorConverter : IMultiValueConverter
return result; return result;
} }
/// <summary>
/// 计算
/// </summary>
/// <param name="value1">值1</param>
/// <param name="operatorChar">符号</param>
/// <param name="value2">值2</param>
/// <returns>结果</returns>
/// <exception cref="NotImplementedException"></exception>
public static double Operation(double value1, char operatorChar, double value2) public static double Operation(double value1, char operatorChar, double value2)
{ {
return operatorChar switch return operatorChar switch
@ -84,14 +97,4 @@ public class CalculatorConverter : IMultiValueConverter
_ => throw new NotImplementedException(), _ => throw new NotImplementedException(),
}; };
} }
public object[] ConvertBack(
object value,
Type[] targetTypes,
object parameter,
CultureInfo culture
)
{
throw new NotImplementedException();
}
} }

View File

@ -0,0 +1,47 @@
using System.ComponentModel;
using System.Windows;
namespace HKW.WPF.Converters;
public abstract class BoolToValueConverterBase<T> : ValueConverterBase
{
/// <summary>
///
/// </summary>
public static readonly DependencyProperty BoolValueProperty = DependencyProperty.Register(
nameof(BoolValue),
typeof(bool),
typeof(T),
new PropertyMetadata(true)
);
/// <summary>
/// 目标布尔值
/// </summary>
[DefaultValue(true)]
public bool BoolValue
{
get => (bool)GetValue(BoolValueProperty);
set => SetValue(BoolValueProperty, value);
}
/// <summary>
///
/// </summary>
public static readonly DependencyProperty NullValueProperty = DependencyProperty.Register(
nameof(NullValue),
typeof(bool),
typeof(T),
new PropertyMetadata(false)
);
/// <summary>
/// 为空值时布尔值
/// </summary>
[DefaultValue(false)]
public bool NullValue
{
get => (bool)GetValue(NullValueProperty);
set => SetValue(NullValueProperty, value);
}
}

View File

@ -0,0 +1,31 @@
using System.ComponentModel;
using System.Windows;
namespace HKW.WPF.Converters;
/// <summary>
/// 可反转值转换器
/// </summary>
public abstract class CanInverterMultiValueConverter<T> : MultiValueConverterBase
where T : CanInverterMultiValueConverter<T>
{
/// <summary>
///
/// </summary>
public static readonly DependencyProperty InverterProperty = DependencyProperty.Register(
nameof(Inverter),
typeof(bool),
typeof(AllIsBoolToVisibilityConverter),
new PropertyMetadata(false)
);
/// <summary>
/// 反转
/// </summary>
[DefaultValue(false)]
public bool Inverter
{
get => (bool)GetValue(InverterProperty);
set => SetValue(InverterProperty, value);
}
}

View File

@ -0,0 +1,31 @@
using System.ComponentModel;
using System.Windows;
namespace HKW.WPF.Converters;
/// <summary>
/// 可反转值转换器
/// </summary>
public abstract class CanInverterValueConverter<T> : ValueConverterBase
where T : CanInverterValueConverter<T>
{
/// <summary>
///
/// </summary>
public static readonly DependencyProperty InverterProperty = DependencyProperty.Register(
nameof(Inverter),
typeof(bool),
typeof(AllIsBoolToVisibilityConverter),
new PropertyMetadata(false)
);
/// <summary>
/// 反转
/// </summary>
[DefaultValue(false)]
public bool Inverter
{
get => (bool)GetValue(InverterProperty);
set => SetValue(InverterProperty, value);
}
}

View File

@ -0,0 +1,15 @@
using System.Globalization;
using System.Windows;
namespace HKW.WPF.Converters;
/// <summary>
/// 值转换器基础
/// </summary>
public abstract class ConverterBase : DependencyObject
{
/// <summary>
/// 未设置值
/// </summary>
public static readonly object UnsetValue = DependencyProperty.UnsetValue;
}

View File

@ -0,0 +1,32 @@
using System.ComponentModel;
using System.Windows;
namespace HKW.WPF.Converters;
/// <summary>
/// 含有比率的转换器
/// </summary>
/// <typeparam name="T">转换器类型</typeparam>
public abstract class HaveRatioConverter<T> : MultiValueConverterBase
where T : HaveRatioConverter<T>
{
/// <summary>
///
/// </summary>
public static readonly DependencyProperty HaveRatioProperty = DependencyProperty.Register(
nameof(HaveRatio),
typeof(bool),
typeof(T),
new PropertyMetadata(false)
);
/// <summary>
/// 含有比例
/// </summary>
[DefaultValue(false)]
public bool HaveRatio
{
get => (bool)GetValue(HaveRatioProperty);
set => SetValue(HaveRatioProperty, value);
}
}

View File

@ -0,0 +1,45 @@
using System.Globalization;
using System.Windows.Data;
namespace HKW.WPF.Converters;
/// <summary>
/// 多个值转换器
/// </summary>
public abstract class MultiValueConverterBase : ConverterBase, IMultiValueConverter
{
/// <summary>
/// 转换
/// </summary>
/// <param name="values">值</param>
/// <param name="targetType">目标类型</param>
/// <param name="parameter">参数</param>
/// <param name="culture">文化</param>
/// <returns>转换后的值</returns>
public abstract object Convert(
object[] values,
Type targetType,
object parameter,
CultureInfo culture
);
/// <summary>
/// 转换回调
/// </summary>
/// <param name="value">值</param>
/// <param name="targetType">目标类型</param>
/// <param name="parameter">参数</param>
/// <param name="culture">文化</param>
/// <returns>转换后的值</returns>
public virtual object[] ConvertBack(
object value,
Type[] targetType,
object parameter,
CultureInfo culture
)
{
throw new NotSupportedException(
"Converter '" + this.GetType().Name + "' does not support backward conversion."
);
}
}

View File

@ -0,0 +1,31 @@
using System.ComponentModel;
using System.Windows;
namespace HKW.WPF.Converters;
/// <summary>
/// 转换至布尔转换器基础
/// </summary>
public abstract class MultiValueToBoolConverter<T> : MultiValueConverterBase
where T : MultiValueToBoolConverter<T>
{
/// <summary>
///
/// </summary>
public static readonly DependencyProperty TargetBoolValueProperty = DependencyProperty.Register(
nameof(TargetBoolValue),
typeof(bool),
typeof(T),
new PropertyMetadata(false)
);
/// <summary>
/// 指定值
/// </summary>
[DefaultValue(false)]
public bool TargetBoolValue
{
get => (bool)GetValue(TargetBoolValueProperty);
set => SetValue(TargetBoolValueProperty, value);
}
}

View File

@ -0,0 +1,45 @@
using System.Globalization;
using System.Windows.Data;
namespace HKW.WPF.Converters;
/// <summary>
/// 值转换器
/// </summary>
public abstract class ValueConverterBase : ConverterBase, IValueConverter
{
/// <summary>
/// 转换
/// </summary>
/// <param name="value">值</param>
/// <param name="targetType">目标类型</param>
/// <param name="parameter">参数</param>
/// <param name="culture">文化</param>
/// <returns>转换后的值</returns>
public abstract object Convert(
object value,
Type targetType,
object parameter,
CultureInfo culture
);
/// <summary>
/// 转换回调
/// </summary>
/// <param name="value">值</param>
/// <param name="targetType">目标类型</param>
/// <param name="parameter">参数</param>
/// <param name="culture">文化</param>
/// <returns>转换后的值</returns>
public virtual object ConvertBack(
object value,
Type targetType,
object parameter,
CultureInfo culture
)
{
throw new NotSupportedException(
"Converter '" + GetType().Name + "' does not support backward conversion."
);
}
}

View File

@ -1,28 +1,37 @@
using System.Windows.Data; using System.Globalization;
namespace VPet.House.Converters; namespace HKW.WPF.Converters;
public class EqualsConverter : IMultiValueConverter /// <summary>
/// 相等转换器
/// <para>示例:
/// <code><![CDATA[
/// <MultiBinding Converter="{StaticResource RatioMarginConverter}">
/// <Binding Path="Value1" />
/// <Binding Path="Value2" />
/// </MultiBinding>
/// ]]></code></para>
/// </summary>
public class EqualsConverter : CanInverterMultiValueConverter<EqualsConverter>
{ {
public object Convert( /// <summary>
///
/// </summary>
/// <param name="values"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public override object Convert(
object[] values, object[] values,
Type targetType, Type targetType,
object parameter, object parameter,
System.Globalization.CultureInfo culture CultureInfo culture
) )
{ {
if (values.Length != 2) if (values.Length != 2)
throw new NotImplementedException("Values length must be 2"); throw new NotImplementedException("Values length must be 2");
return values[0].Equals(values[1]); return values[0].Equals(values[1]) ^ Inverter;
}
public object[] ConvertBack(
object value,
Type[] targetTypes,
object parameter,
System.Globalization.CultureInfo culture
)
{
throw new NotImplementedException();
} }
} }

View File

@ -1,20 +0,0 @@
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace VPet.House.Converters;
public class FalseToCollapsedConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool.TryParse(value.ToString(), out var result) && result)
? Visibility.Visible
: Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is Visibility visibility && visibility == Visibility.Collapsed;
}
}

View File

@ -1,20 +0,0 @@
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace VPet.House.Converters;
public class FalseToHiddenConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool.TryParse(value.ToString(), out var result) && result)
? Visibility.Visible
: Visibility.Hidden;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is Visibility visibility && visibility == Visibility.Hidden;
}
}

View File

@ -0,0 +1,62 @@
using System.ComponentModel;
using System.Globalization;
using System.Windows;
namespace HKW.WPF.Converters;
/// <summary>
/// 是布尔值转换器
/// </summary>
public class IsBoolConverter : ValueConverterBase
{
/// <summary>
///
/// </summary>
public static readonly DependencyProperty BoolValueProperty = DependencyProperty.Register(
nameof(BoolValue),
typeof(bool),
typeof(AllIsBoolToVisibilityConverter),
new PropertyMetadata(true)
);
/// <summary>
/// 目标布尔值
/// </summary>
[DefaultValue(true)]
public bool BoolValue
{
get => (bool)GetValue(BoolValueProperty);
set => SetValue(BoolValueProperty, value);
}
/// <summary>
///
/// </summary>
public static readonly DependencyProperty NullValueProperty = DependencyProperty.Register(
nameof(NullValue),
typeof(bool),
typeof(AllIsBoolToVisibilityConverter),
new PropertyMetadata(false)
);
/// <summary>
/// 为空值时布尔值
/// </summary>
[DefaultValue(false)]
public bool NullValue
{
get => (bool)GetValue(NullValueProperty);
set => SetValue(NullValueProperty, value);
}
/// <inheritdoc/>
public override object Convert(
object value,
Type targetType,
object parameter,
CultureInfo culture
)
{
return Utils.GetBool(value, BoolValue, NullValue);
}
}

View File

@ -1,7 +1,7 @@
using System.Windows; using System.Globalization;
using System.Windows.Data; using System.Windows;
namespace VPet.House.Converters; namespace HKW.WPF.Converters;
/// <summary> /// <summary>
/// 边距转换器 /// 边距转换器
@ -15,70 +15,124 @@ namespace VPet.House.Converters;
/// </MultiBinding> /// </MultiBinding>
/// ]]></code></para> /// ]]></code></para>
/// </summary> /// </summary>
public class MarginConverter : IMultiValueConverter public class MarginConverter : HaveRatioConverter<MarginConverter>
{ {
public object Convert( /// <summary>
///
/// </summary>
/// <param name="values"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public override object Convert(
object[] values, object[] values,
Type targetType, Type targetType,
object parameter, object parameter,
System.Globalization.CultureInfo culture CultureInfo culture
) )
{ {
if (values.Any(i => i == DependencyProperty.UnsetValue))
return new Thickness();
if (values.Length == 0) if (values.Length == 0)
{ {
return new Thickness(); return new Thickness();
} }
else if (values.Length == 1) if (HaveRatio)
{ {
return new Thickness() if (values.Length == 1)
{ {
Left = System.Convert.ToDouble(values[0]), return new Thickness();
Top = default, }
Right = default, var ratio = System.Convert.ToDouble(values[0]);
Bottom = default if (values.Length == 2)
};
}
else if (values.Length == 2)
{
return new Thickness()
{ {
Left = System.Convert.ToDouble(values[0]), return new Thickness()
Top = System.Convert.ToDouble(values[1]), {
Right = default, Left = System.Convert.ToDouble(values[1]) * ratio,
Bottom = default Top = default,
}; Right = default,
} Bottom = default
else if (values.Length == 3) };
{ }
return new Thickness() else if (values.Length == 3)
{ {
Left = System.Convert.ToDouble(values[0]), return new Thickness()
Top = System.Convert.ToDouble(values[1]), {
Right = System.Convert.ToDouble(values[2]), Left = System.Convert.ToDouble(values[1]) * ratio,
Bottom = default Top = System.Convert.ToDouble(values[2]) * ratio,
}; Right = default,
} Bottom = default
else if (values.Length == 4) };
{ }
return new Thickness() else if (values.Length == 4)
{ {
Left = System.Convert.ToDouble(values[0]), return new Thickness()
Top = System.Convert.ToDouble(values[1]), {
Right = System.Convert.ToDouble(values[2]), Left = System.Convert.ToDouble(values[1]) * ratio,
Bottom = System.Convert.ToDouble(values[3]) Top = System.Convert.ToDouble(values[2]) * ratio,
}; Right = System.Convert.ToDouble(values[3]) * ratio,
Bottom = default
};
}
else if (values.Length == 5)
{
return new Thickness()
{
Left = System.Convert.ToDouble(values[1]) * ratio,
Top = System.Convert.ToDouble(values[2]) * ratio,
Right = System.Convert.ToDouble(values[3]) * ratio,
Bottom = System.Convert.ToDouble(values[4]) * ratio
};
}
else
throw new NotImplementedException();
} }
else else
throw new NotImplementedException(); {
} if (values.Length == 1)
{
public object[] ConvertBack( return new Thickness()
object value, {
Type[] targetTypes, Left = System.Convert.ToDouble(values[0]),
object parameter, Top = default,
System.Globalization.CultureInfo culture Right = default,
) Bottom = default
{ };
throw new NotImplementedException(); }
else if (values.Length == 2)
{
return new Thickness()
{
Left = System.Convert.ToDouble(values[0]),
Top = System.Convert.ToDouble(values[1]),
Right = default,
Bottom = default
};
}
else if (values.Length == 3)
{
return new Thickness()
{
Left = System.Convert.ToDouble(values[0]),
Top = System.Convert.ToDouble(values[1]),
Right = System.Convert.ToDouble(values[2]),
Bottom = default
};
}
else if (values.Length == 4)
{
return new Thickness()
{
Left = System.Convert.ToDouble(values[0]),
Top = System.Convert.ToDouble(values[1]),
Right = System.Convert.ToDouble(values[2]),
Bottom = System.Convert.ToDouble(values[3])
};
}
else
throw new NotImplementedException();
}
} }
} }

View File

@ -1,10 +1,12 @@
using System.Windows.Data; using System.Windows.Data;
namespace VPet.House.Converters; using System.Windows;
public class MaxConverter : IMultiValueConverter namespace HKW.WPF.Converters;
public class MaxConverter : MultiValueConverterBase
{ {
public object Convert( public override object Convert(
object[] values, object[] values,
Type targetType, Type targetType,
object parameter, object parameter,
@ -13,14 +15,4 @@ public class MaxConverter : IMultiValueConverter
{ {
return values.Max(i => (double)i); return values.Max(i => (double)i);
} }
public object[] ConvertBack(
object value,
Type[] targetTypes,
object parameter,
System.Globalization.CultureInfo culture
)
{
throw new NotImplementedException();
}
} }

View File

@ -1,22 +1,55 @@
using System.Globalization; using System.Globalization;
using System.Windows.Data;
using System.Windows.Media; using System.Windows.Media;
namespace VPet.House.Converters; namespace HKW.WPF.Converters;
public class MediaColorToBrushConverter : IValueConverter /// <summary>
/// 媒体颜色至画笔颜色转换器
/// </summary>
public class MediaColorToBrushConverter : ValueConverterBase
{ {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) /// <summary>
///
/// </summary>
/// <param name="value"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
/// <exception cref="ArgumentException"></exception>
public override object Convert(
object value,
Type targetType,
object parameter,
CultureInfo culture
)
{ {
if (value is not Color color) if (value is not Color color)
throw new ArgumentException("Not media color", nameof(value)); throw new ArgumentException($"Not type: {typeof(Color).FullName}", nameof(value));
return new SolidColorBrush(color); return new SolidColorBrush(color);
} }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) /// <summary>
///
/// </summary>
/// <param name="value"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
/// <exception cref="ArgumentException"></exception>
public override object ConvertBack(
object value,
Type targetType,
object parameter,
CultureInfo culture
)
{ {
if (value is not SolidColorBrush brush) if (value is not SolidColorBrush brush)
throw new ArgumentException("Not SolidColorBrush", nameof(value)); throw new ArgumentException(
$"Not type: {typeof(SolidColorBrush).FullName}",
nameof(value)
);
return brush.Color; return brush.Color;
} }
} }

View File

@ -1,28 +0,0 @@
using System.Windows.Data;
namespace VPet.House.Converters;
public class NotEqualsConverter : IMultiValueConverter
{
public object Convert(
object[] values,
Type targetType,
object parameter,
System.Globalization.CultureInfo culture
)
{
if (values.Length != 2)
throw new NotImplementedException("Values length must be 2");
return !values[0].Equals(values[1]);
}
public object[] ConvertBack(
object value,
Type[] targetTypes,
object parameter,
System.Globalization.CultureInfo culture
)
{
throw new NotImplementedException();
}
}

View File

@ -1,17 +0,0 @@
using System.Globalization;
using System.Windows.Data;
namespace VPet.House.Converters;
public class NullToFalseConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is not null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

View File

@ -1,91 +0,0 @@
using System.Windows;
using System.Windows.Data;
namespace VPet.House.Converters;
/// <summary>
/// 边距转换器
/// <para>示例:
/// <code><![CDATA[
/// <MultiBinding Converter="{StaticResource RatioMarginConverter}">
/// <Binding Path="Left" />
/// <Binding Path="Top" />
/// <Binding Path="Right" />
/// <Binding Path="Bottom" />
/// </MultiBinding>
/// ]]></code></para>
/// </summary>
public class RatioMarginConverter : IMultiValueConverter
{
public object Convert(
object[] values,
Type targetType,
object parameter,
System.Globalization.CultureInfo culture
)
{
if (values.Any(i => i == DependencyProperty.UnsetValue))
return new Thickness();
if (values.Length == 0)
{
return new Thickness();
}
else if (values.Length == 1)
{
return new Thickness();
}
var ratio = System.Convert.ToDouble(values[0]);
if (values.Length == 2)
{
return new Thickness()
{
Left = System.Convert.ToDouble(values[1]) * ratio,
Top = default,
Right = default,
Bottom = default
};
}
else if (values.Length == 3)
{
return new Thickness()
{
Left = System.Convert.ToDouble(values[1]) * ratio,
Top = System.Convert.ToDouble(values[2]) * ratio,
Right = default,
Bottom = default
};
}
else if (values.Length == 4)
{
return new Thickness()
{
Left = System.Convert.ToDouble(values[1]) * ratio,
Top = System.Convert.ToDouble(values[2]) * ratio,
Right = System.Convert.ToDouble(values[3]) * ratio,
Bottom = default
};
}
else if (values.Length == 5)
{
return new Thickness()
{
Left = System.Convert.ToDouble(values[1]) * ratio,
Top = System.Convert.ToDouble(values[2]) * ratio,
Right = System.Convert.ToDouble(values[3]) * ratio,
Bottom = System.Convert.ToDouble(values[4]) * ratio
};
}
else
throw new NotImplementedException();
}
public object[] ConvertBack(
object value,
Type[] targetTypes,
object parameter,
System.Globalization.CultureInfo culture
)
{
throw new NotImplementedException();
}
}

View File

@ -1,9 +1,9 @@
using System.Windows.Data; using System.Globalization;
namespace VPet.House.Converters; namespace HKW.WPF.Converters;
/// <summary> /// <summary>
/// 边距转换 /// 字符串格式化
/// <para>示例: /// <para>示例:
/// <code><![CDATA[ /// <code><![CDATA[
/// <MultiBinding Converter="{StaticResource MarginConverter}"> /// <MultiBinding Converter="{StaticResource MarginConverter}">
@ -18,13 +18,21 @@ namespace VPet.House.Converters;
/// </MultiBinding> /// </MultiBinding>
/// ]]></code></para> /// ]]></code></para>
/// </summary> /// </summary>
public class StringFormatConverter : IMultiValueConverter public class StringFormatConverter : MultiValueConverterBase
{ {
public object Convert( /// <summary>
///
/// </summary>
/// <param name="values"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
public override object Convert(
object[] values, object[] values,
Type targetType, Type targetType,
object parameter, object parameter,
System.Globalization.CultureInfo culture CultureInfo culture
) )
{ {
var formatStr = (string)parameter; var formatStr = (string)parameter;
@ -38,14 +46,4 @@ public class StringFormatConverter : IMultiValueConverter
return string.Format(formatStr, values); return string.Format(formatStr, values);
} }
} }
public object[] ConvertBack(
object value,
Type[] targetTypes,
object parameter,
System.Globalization.CultureInfo culture
)
{
throw new NotImplementedException();
}
} }

View File

@ -0,0 +1,22 @@
using HKW.WPF.Converters;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HKW.WPF.Converters;
public class ValueToBoolConverter : ValueConverterBase
{
public override object Convert(
object value,
Type targetType,
object parameter,
CultureInfo culture
)
{
throw new NotImplementedException();
}
}

View File

@ -76,4 +76,16 @@ public static class Utils
} }
return bitmapImage; return bitmapImage;
} }
public static bool GetBool(object value, bool boolValue, bool nullValue)
{
if (value is null)
return nullValue;
else if (value is bool b)
return b == boolValue;
else if (bool.TryParse(value.ToString(), out b))
return b == boolValue;
else
return false;
}
} }

View File

@ -74,6 +74,26 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</ApplicationDefinition> </ApplicationDefinition>
<Compile Include="Converters\AllIsBoolConverter.cs" />
<Compile Include="Converters\AllIsBoolToVisibilityConverter.cs" />
<Compile Include="Converters\ConverterBase\BoolToValueConverterBase.cs" />
<Compile Include="Converters\BrushToMediaColorConverter.cs" />
<Compile Include="Converters\CalculatorConverter.cs" />
<Compile Include="Converters\ConverterBase\CanInverterMultiValueConverter.cs" />
<Compile Include="Converters\ConverterBase\CanInverterValueConverter.cs" />
<Compile Include="Converters\ConverterBase\ConverterBase.cs" />
<Compile Include="Converters\ConverterBase\HaveRatioConverter.cs" />
<Compile Include="Converters\ConverterBase\MultiValueConverterBase.cs" />
<Compile Include="Converters\ConverterBase\MultiValueToBoolConverter.cs" />
<Compile Include="Converters\ConverterBase\ValueConverterBase.cs" />
<Compile Include="Converters\EqualsConverter.cs" />
<Compile Include="Converters\IsBoolConverter.cs" />
<Compile Include="Converters\MarginConverter.cs" />
<Compile Include="Converters\MediaColorToBrushConverter.cs" />
<Compile Include="Converters\StringFormatConverter.cs" />
<Compile Include="Converters\BoolToVisibilityConverter.cs" />
<Compile Include="Converters\MaxConverter.cs" />
<Compile Include="Converters\ValueToBoolConverter.cs" />
<Compile Include="Converters\BoolInverter.cs" /> <Compile Include="Converters\BoolInverter.cs" />
<Compile Include="Models\GraphicsSettingModel.cs" /> <Compile Include="Models\GraphicsSettingModel.cs" />
<Compile Include="Models\InteractiveSettingModel.cs" /> <Compile Include="Models\InteractiveSettingModel.cs" />
@ -146,18 +166,6 @@
<Compile Include="Views\MainWindow.xaml.cs"> <Compile Include="Views\MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon> <DependentUpon>MainWindow.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Converters\BrushToMediaColorConverter.cs" />
<Compile Include="Converters\CalculatorConverter.cs" />
<Compile Include="Converters\EqualsConverter.cs" />
<Compile Include="Converters\FalseToCollapsedConverter.cs" />
<Compile Include="Converters\FalseToHiddenConverter.cs" />
<Compile Include="Converters\MediaColorToBrushConverter.cs" />
<Compile Include="Converters\NotEqualsConverter.cs" />
<Compile Include="Converters\NullToFalseConverter.cs" />
<Compile Include="Converters\StringFormatConverter.cs" />
<Compile Include="Converters\RatioMarginConverter.cs" />
<Compile Include="Converters\MaxConverter.cs" />
<Compile Include="Converters\MarginConverter.cs" />
<Compile Include="SimpleObservable\ObservableClass\INotifyPropertyChangedX.cs" /> <Compile Include="SimpleObservable\ObservableClass\INotifyPropertyChangedX.cs" />
<Compile Include="SimpleObservable\ObservableClass\INotifyPropertyChangingX.cs" /> <Compile Include="SimpleObservable\ObservableClass\INotifyPropertyChangingX.cs" />
<Compile Include="SimpleObservable\ObservableClass\ObservableClass.cs" /> <Compile Include="SimpleObservable\ObservableClass\ObservableClass.cs" />