mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
更新 VPet.Solution
This commit is contained in:
parent
6aac99b85f
commit
9fffaaaa95
@ -1,4 +1,5 @@
|
|||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
<ResourceDictionary
|
||||||
|
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:pu="https://opensource.panuon.com/wpf-ui"
|
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||||
xmlns:pucore="clr-namespace:Panuon.WPF;assembly=Panuon.WPF">
|
xmlns:pucore="clr-namespace:Panuon.WPF;assembly=Panuon.WPF">
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
<ResourceDictionary
|
||||||
|
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:pu="https://opensource.panuon.com/wpf-ui"
|
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||||
xmlns:pucore="clr-namespace:Panuon.WPF;assembly=Panuon.WPF">
|
xmlns:pucore="clr-namespace:Panuon.WPF;assembly=Panuon.WPF">
|
||||||
@ -6,8 +7,12 @@
|
|||||||
<pucore:SharedResourceDictionary Source="/Panuon.WPF.UI;component/Control.xaml" />
|
<pucore:SharedResourceDictionary Source="/Panuon.WPF.UI;component/Control.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
<DrawingBrush x:Key="ProgressBarForeground" Viewport="0,0,8,22" ViewportUnits="Absolute" Stretch="None"
|
<DrawingBrush
|
||||||
TileMode="Tile">
|
x:Key="ProgressBarForeground"
|
||||||
|
Stretch="None"
|
||||||
|
TileMode="Tile"
|
||||||
|
Viewport="0,0,8,22"
|
||||||
|
ViewportUnits="Absolute">
|
||||||
<DrawingBrush.RelativeTransform>
|
<DrawingBrush.RelativeTransform>
|
||||||
<RotateTransform Angle="2" />
|
<RotateTransform Angle="2" />
|
||||||
</DrawingBrush.RelativeTransform>
|
</DrawingBrush.RelativeTransform>
|
||||||
@ -30,8 +35,12 @@
|
|||||||
</DrawingGroup>
|
</DrawingGroup>
|
||||||
</DrawingBrush.Drawing>
|
</DrawingBrush.Drawing>
|
||||||
</DrawingBrush>
|
</DrawingBrush>
|
||||||
<DrawingBrush x:Key="SuccessProgressBarForeground" Viewport="0,0,8,22" ViewportUnits="Absolute" Stretch="None"
|
<DrawingBrush
|
||||||
TileMode="Tile">
|
x:Key="SuccessProgressBarForeground"
|
||||||
|
Stretch="None"
|
||||||
|
TileMode="Tile"
|
||||||
|
Viewport="0,0,8,22"
|
||||||
|
ViewportUnits="Absolute">
|
||||||
<DrawingBrush.RelativeTransform>
|
<DrawingBrush.RelativeTransform>
|
||||||
<RotateTransform Angle="2" />
|
<RotateTransform Angle="2" />
|
||||||
</DrawingBrush.RelativeTransform>
|
</DrawingBrush.RelativeTransform>
|
||||||
@ -54,8 +63,12 @@
|
|||||||
</DrawingGroup>
|
</DrawingGroup>
|
||||||
</DrawingBrush.Drawing>
|
</DrawingBrush.Drawing>
|
||||||
</DrawingBrush>
|
</DrawingBrush>
|
||||||
<DrawingBrush x:Key="WarningProgressBarForeground" Viewport="0,0,8,22" ViewportUnits="Absolute" Stretch="None"
|
<DrawingBrush
|
||||||
TileMode="Tile">
|
x:Key="WarningProgressBarForeground"
|
||||||
|
Stretch="None"
|
||||||
|
TileMode="Tile"
|
||||||
|
Viewport="0,0,8,22"
|
||||||
|
ViewportUnits="Absolute">
|
||||||
<DrawingBrush.RelativeTransform>
|
<DrawingBrush.RelativeTransform>
|
||||||
<RotateTransform Angle="2" />
|
<RotateTransform Angle="2" />
|
||||||
</DrawingBrush.RelativeTransform>
|
</DrawingBrush.RelativeTransform>
|
||||||
@ -78,8 +91,12 @@
|
|||||||
</DrawingGroup>
|
</DrawingGroup>
|
||||||
</DrawingBrush.Drawing>
|
</DrawingBrush.Drawing>
|
||||||
</DrawingBrush>
|
</DrawingBrush>
|
||||||
<DrawingBrush x:Key="DangerProgressBarForeground" Viewport="0,0,8,22" ViewportUnits="Absolute" Stretch="None"
|
<DrawingBrush
|
||||||
TileMode="Tile">
|
x:Key="DangerProgressBarForeground"
|
||||||
|
Stretch="None"
|
||||||
|
TileMode="Tile"
|
||||||
|
Viewport="0,0,8,22"
|
||||||
|
ViewportUnits="Absolute">
|
||||||
<DrawingBrush.RelativeTransform>
|
<DrawingBrush.RelativeTransform>
|
||||||
<RotateTransform Angle="2" />
|
<RotateTransform Angle="2" />
|
||||||
</DrawingBrush.RelativeTransform>
|
</DrawingBrush.RelativeTransform>
|
||||||
@ -109,21 +126,27 @@
|
|||||||
<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
|
||||||
|
x:Key="ThemedButtonStyle"
|
||||||
|
BasedOn="{StaticResource {x:Type Button}}"
|
||||||
|
TargetType="{x:Type Button}">
|
||||||
<Setter Property="Background" Value="{DynamicResource DARKPrimary}" />
|
<Setter Property="Background" Value="{DynamicResource DARKPrimary}" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource DARKPrimaryText}" />
|
<Setter Property="Foreground" Value="{DynamicResource DARKPrimaryText}" />
|
||||||
<Setter Property="Padding" Value="10,5" />
|
<Setter Property="Padding" Value="10,5" />
|
||||||
<Setter Property="pu:ButtonHelper.CornerRadius" Value="5" />
|
<Setter Property="pu:ButtonHelper.CornerRadius" Value="5" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="TextButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
<Style
|
||||||
|
x:Key="TextButtonStyle"
|
||||||
|
BasedOn="{StaticResource {x:Type Button}}"
|
||||||
|
TargetType="{x:Type Button}">
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryDarker}" />
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryDarker}" />
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
@ -131,11 +154,17 @@
|
|||||||
<Setter Property="FontSize" Value="12" />
|
<Setter Property="FontSize" Value="12" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="DARKPrimaryTextButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource TextButtonStyle}">
|
<Style
|
||||||
|
x:Key="DARKPrimaryTextButtonStyle"
|
||||||
|
BasedOn="{StaticResource TextButtonStyle}"
|
||||||
|
TargetType="{x:Type Button}">
|
||||||
<Setter Property="Foreground" Value="{DynamicResource DARKPrimaryText}" />
|
<Setter Property="Foreground" Value="{DynamicResource DARKPrimaryText}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="IconInvertedForegroundRepeatButtonStyle" TargetType="{x:Type RepeatButton}" BasedOn="{StaticResource {x:Type RepeatButton}}">
|
<Style
|
||||||
|
x:Key="IconInvertedForegroundRepeatButtonStyle"
|
||||||
|
BasedOn="{StaticResource {x:Type RepeatButton}}"
|
||||||
|
TargetType="{x:Type RepeatButton}">
|
||||||
<Setter Property="Width" Value="25" />
|
<Setter Property="Width" Value="25" />
|
||||||
<Setter Property="Height" Value="25" />
|
<Setter Property="Height" Value="25" />
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
@ -146,26 +175,34 @@
|
|||||||
<Setter Property="FontFamily" Value="pack://application:,,,/Res/#remixicon" />
|
<Setter Property="FontFamily" Value="pack://application:,,,/Res/#remixicon" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="LinkButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource TextButtonStyle}">
|
<Style
|
||||||
|
x:Key="LinkButtonStyle"
|
||||||
|
BasedOn="{StaticResource TextButtonStyle}"
|
||||||
|
TargetType="{x:Type Button}">
|
||||||
<Setter Property="ContentTemplate">
|
<Setter Property="ContentTemplate">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding}"
|
<TextBlock Text="{Binding}" TextDecorations="Underline" />
|
||||||
TextDecorations="Underline" />
|
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="StndardToggleButtonStyle" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
|
<Style
|
||||||
|
x:Key="StndardToggleButtonStyle"
|
||||||
|
BasedOn="{StaticResource {x:Type ToggleButton}}"
|
||||||
|
TargetType="{x:Type ToggleButton}">
|
||||||
<Setter Property="Background" Value="{DynamicResource DARKPrimary}" />
|
<Setter Property="Background" Value="{DynamicResource DARKPrimary}" />
|
||||||
<Setter Property="pu:ToggleButtonHelper.CheckedBackground" Value="{DynamicResource DARKPrimaryDarker}"/>
|
<Setter Property="pu:ToggleButtonHelper.CheckedBackground" Value="{DynamicResource DARKPrimaryDarker}" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource DARKPrimaryText}" />
|
<Setter Property="Foreground" Value="{DynamicResource DARKPrimaryText}" />
|
||||||
<Setter Property="Padding" Value="10,5" />
|
<Setter Property="Padding" Value="10,5" />
|
||||||
<Setter Property="pu:ButtonHelper.CornerRadius" Value="5" />
|
<Setter Property="pu:ButtonHelper.CornerRadius" Value="5" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="TextToggleButtonStyle" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
|
<Style
|
||||||
|
x:Key="TextToggleButtonStyle"
|
||||||
|
BasedOn="{StaticResource {x:Type ToggleButton}}"
|
||||||
|
TargetType="{x:Type ToggleButton}">
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryDarker}" />
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryDarker}" />
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
@ -173,7 +210,10 @@
|
|||||||
<Setter Property="FontSize" Value="14" />
|
<Setter Property="FontSize" Value="14" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="LinkToggleButtonStyle" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource TextToggleButtonStyle}">
|
<Style
|
||||||
|
x:Key="LinkToggleButtonStyle"
|
||||||
|
BasedOn="{StaticResource TextToggleButtonStyle}"
|
||||||
|
TargetType="{x:Type ToggleButton}">
|
||||||
<Setter Property="ContentTemplate">
|
<Setter Property="ContentTemplate">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
@ -193,7 +233,10 @@
|
|||||||
<Setter Property="ItemsCornerRadius" Value="2" />
|
<Setter Property="ItemsCornerRadius" Value="2" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="StandardComboBoxStyle" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}">
|
<Style
|
||||||
|
x:Key="StandardComboBoxStyle"
|
||||||
|
BasedOn="{StaticResource {x:Type ComboBox}}"
|
||||||
|
TargetType="{x:Type ComboBox}">
|
||||||
<Setter Property="FontSize" Value="14" />
|
<Setter Property="FontSize" Value="14" />
|
||||||
<Setter Property="Height" Value="30" />
|
<Setter Property="Height" Value="30" />
|
||||||
<Setter Property="Background" Value="{DynamicResource DARKPrimaryText}" />
|
<Setter Property="Background" Value="{DynamicResource DARKPrimaryText}" />
|
||||||
@ -217,8 +260,7 @@
|
|||||||
<Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
|
<Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
|
||||||
<Setter Property="pu:ComboBoxHelper.ToggleArrowTransformControlStyle">
|
<Setter Property="pu:ComboBoxHelper.ToggleArrowTransformControlStyle">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<Style TargetType="pu:TransformControl"
|
<Style BasedOn="{StaticResource {x:Static pu:ComboBoxHelper.ToggleArrowTransformControlStyleKey}}" TargetType="pu:TransformControl">
|
||||||
BasedOn="{StaticResource {x:Static pu:ComboBoxHelper.ToggleArrowTransformControlStyleKey}}">
|
|
||||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryText}" />
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryText}" />
|
||||||
<Setter Property="FontSize" Value="10" />
|
<Setter Property="FontSize" Value="10" />
|
||||||
<Setter Property="Content" Value="" />
|
<Setter Property="Content" Value="" />
|
||||||
@ -226,7 +268,10 @@
|
|||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="StandardTextBoxStyle" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
|
<Style
|
||||||
|
x:Key="StandardTextBoxStyle"
|
||||||
|
BasedOn="{StaticResource {x:Type TextBox}}"
|
||||||
|
TargetType="TextBox">
|
||||||
<Setter Property="FontSize" Value="14" />
|
<Setter Property="FontSize" Value="14" />
|
||||||
<Setter Property="Height" Value="30" />
|
<Setter Property="Height" Value="30" />
|
||||||
<Setter Property="Background" Value="{DynamicResource DARKPrimaryText}" />
|
<Setter Property="Background" Value="{DynamicResource DARKPrimaryText}" />
|
||||||
@ -238,7 +283,10 @@
|
|||||||
<Setter Property="pu:ShadowHelper.BlurRadius" Value="15" />
|
<Setter Property="pu:ShadowHelper.BlurRadius" Value="15" />
|
||||||
<Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
|
<Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="StandardSliderStyle" TargetType="Slider" BasedOn="{StaticResource {x:Type Slider}}">
|
<Style
|
||||||
|
x:Key="StandardSliderStyle"
|
||||||
|
BasedOn="{StaticResource {x:Type Slider}}"
|
||||||
|
TargetType="Slider">
|
||||||
<Setter Property="Background" Value="{DynamicResource DARKPrimaryTrans4}" />
|
<Setter Property="Background" Value="{DynamicResource DARKPrimaryTrans4}" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource DARKPrimaryDark}" />
|
<Setter Property="Foreground" Value="{DynamicResource DARKPrimaryDark}" />
|
||||||
<Setter Property="pu:SliderHelper.ThumbShadowColor" Value="{DynamicResource ShadowColor}" />
|
<Setter Property="pu:SliderHelper.ThumbShadowColor" Value="{DynamicResource ShadowColor}" />
|
||||||
@ -251,12 +299,18 @@
|
|||||||
<Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
|
<Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="StandardRadioButtonStyle" TargetType="RadioButton" BasedOn="{StaticResource {x:Type RadioButton}}">
|
<Style
|
||||||
|
x:Key="StandardRadioButtonStyle"
|
||||||
|
BasedOn="{StaticResource {x:Type RadioButton}}"
|
||||||
|
TargetType="RadioButton">
|
||||||
<Setter Property="pu:RadioButtonHelper.CheckedToggleBrush" Value="{DynamicResource DARKPrimary}" />
|
<Setter Property="pu:RadioButtonHelper.CheckedToggleBrush" Value="{DynamicResource DARKPrimary}" />
|
||||||
<Setter Property="pu:RadioButtonHelper.CheckedBorderBrush" Value="{DynamicResource DARKPrimary}" />
|
<Setter Property="pu:RadioButtonHelper.CheckedBorderBrush" Value="{DynamicResource DARKPrimary}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="SideMenuListBoxStyle" TargetType="ListBox" BasedOn="{StaticResource {x:Type ListBox}}">
|
<Style
|
||||||
|
x:Key="SideMenuListBoxStyle"
|
||||||
|
BasedOn="{StaticResource {x:Type ListBox}}"
|
||||||
|
TargetType="ListBox">
|
||||||
<Setter Property="BorderThickness" Value="0" />
|
<Setter Property="BorderThickness" Value="0" />
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
<Setter Property="pu:ListBoxHelper.ItemsHeight" Value="30" />
|
<Setter Property="pu:ListBoxHelper.ItemsHeight" Value="30" />
|
||||||
@ -267,7 +321,10 @@
|
|||||||
<Setter Property="pu:ListBoxHelper.ItemsSelectedForeground" Value="{DynamicResource DARKPrimaryText}" />
|
<Setter Property="pu:ListBoxHelper.ItemsSelectedForeground" Value="{DynamicResource DARKPrimaryText}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="ToolBarMenuStyle" TargetType="Menu" BasedOn="{StaticResource {x:Type Menu}}">
|
<Style
|
||||||
|
x:Key="ToolBarMenuStyle"
|
||||||
|
BasedOn="{StaticResource {x:Type Menu}}"
|
||||||
|
TargetType="Menu">
|
||||||
<Setter Property="Height" Value="55" />
|
<Setter Property="Height" Value="55" />
|
||||||
<Setter Property="FontSize" Value="24" />
|
<Setter Property="FontSize" Value="24" />
|
||||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
|
@ -1,212 +1,139 @@
|
|||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
<ResourceDictionary
|
||||||
|
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:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI"
|
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI"
|
||||||
xmlns:pucore="clr-namespace:Panuon.WPF;assembly=Panuon.WPF">
|
xmlns:pucore="clr-namespace:Panuon.WPF;assembly=Panuon.WPF">
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="/VPet-Simulator.Core;component/Display/Theme.xaml"/>
|
<ResourceDictionary Source="/VPet-Simulator.Core;component/Display/Theme.xaml" />
|
||||||
<ResourceDictionary Source="/VPet-Simulator.Core;component/Display/basestyle.xaml"/>
|
<ResourceDictionary Source="/VPet-Simulator.Core;component/Display/basestyle.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</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"
|
|
||||||
Value="{DynamicResource DARKPrimaryText}" />
|
|
||||||
<Setter Property="pu:WindowXCaption.Buttons"
|
|
||||||
Value="Close" />
|
|
||||||
<Setter Property="pu:WindowXCaption.CloseButtonStyle">
|
<Setter Property="pu:WindowXCaption.CloseButtonStyle">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<Style TargetType="Button"
|
<Style BasedOn="{StaticResource {x:Static pu:WindowXCaption.CloseButtonStyleKey}}" TargetType="Button">
|
||||||
BasedOn="{StaticResource {x:Static pu:WindowXCaption.CloseButtonStyleKey}}">
|
<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="StandardComboBoxStyle"
|
<Style
|
||||||
TargetType="{x:Type ComboBox}"
|
x:Key="StandardComboBoxStyle"
|
||||||
BasedOn="{StaticResource {x:Type ComboBox}}">
|
BasedOn="{StaticResource {x:Type ComboBox}}"
|
||||||
<Setter Property="FontSize"
|
TargetType="{x:Type ComboBox}">
|
||||||
Value="14" />
|
<Setter Property="FontSize" Value="14" />
|
||||||
<Setter Property="Height"
|
<Setter Property="Height" Value="30" />
|
||||||
Value="30" />
|
<Setter Property="Background" Value="{DynamicResource DARKPrimaryText}" />
|
||||||
<Setter Property="Background"
|
<Setter Property="BorderThickness" Value="1.5" />
|
||||||
Value="{DynamicResource DARKPrimaryText}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource DARKPrimary}" />
|
||||||
<Setter Property="BorderThickness"
|
<Setter Property="Padding" Value="7,0,15,0" />
|
||||||
Value="1.5" />
|
<Setter Property="pu:ComboBoxHelper.CornerRadius" Value="5" />
|
||||||
<Setter Property="BorderBrush"
|
<Setter Property="pu:ComboBoxHelper.WatermarkForeground" Value="#DCDCDC" />
|
||||||
Value="{DynamicResource DARKPrimary}" />
|
<Setter Property="pu:ComboBoxHelper.ItemsSelectedBackground" Value="{DynamicResource DARKPrimary}" />
|
||||||
<Setter Property="Padding"
|
<Setter Property="pu:ComboBoxHelper.ItemsSelectedForeground" Value="{DynamicResource DARKPrimaryText}" />
|
||||||
Value="7,0,15,0" />
|
<Setter Property="pu:ComboBoxHelper.ItemsHoverBackground" Value="{DynamicResource DARKPrimaryTrans4}" />
|
||||||
<Setter Property="pu:ComboBoxHelper.CornerRadius"
|
<Setter Property="pu:ComboBoxHelper.ItemsPadding" Value="22,0" />
|
||||||
Value="5" />
|
<Setter Property="pu:DropDownHelper.BorderThickness" Value="1" />
|
||||||
<Setter Property="pu:ComboBoxHelper.WatermarkForeground"
|
<Setter Property="pu:DropDownHelper.Background" Value="{DynamicResource DARKPrimaryText}" />
|
||||||
Value="#DCDCDC" />
|
<Setter Property="pu:DropDownHelper.ShadowColor" Value="{DynamicResource ShadowColor}" />
|
||||||
<Setter Property="pu:ComboBoxHelper.ItemsSelectedBackground"
|
<Setter Property="pu:DropDownHelper.CornerRadius" Value="5" />
|
||||||
Value="{DynamicResource DARKPrimary}" />
|
<Setter Property="pu:DropDownHelper.MinHeight" Value="100" />
|
||||||
<Setter Property="pu:ComboBoxHelper.ItemsSelectedForeground"
|
<Setter Property="pu:DropDownHelper.ClipDockSideShadow" Value="False" />
|
||||||
Value="{DynamicResource DARKPrimaryText}" />
|
<Setter Property="pu:DropDownHelper.BorderBrush" Value="{DynamicResource DARKPrimary}" />
|
||||||
<Setter Property="pu:ComboBoxHelper.ItemsHoverBackground"
|
<Setter Property="pu:ShadowHelper.BlurRadius" Value="15" />
|
||||||
Value="{DynamicResource DARKPrimaryTrans4}" />
|
<Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
|
||||||
<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 Property="pu:ComboBoxHelper.ToggleArrowTransformControlStyle">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<Style TargetType="pu:TransformControl"
|
<Style BasedOn="{StaticResource {x:Static pu:ComboBoxHelper.ToggleArrowTransformControlStyleKey}}" TargetType="pu:TransformControl">
|
||||||
BasedOn="{StaticResource {x:Static pu:ComboBoxHelper.ToggleArrowTransformControlStyleKey}}">
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryText}" />
|
||||||
<Setter Property="Foreground"
|
<Setter Property="FontSize" Value="10" />
|
||||||
Value="{DynamicResource PrimaryText}" />
|
<Setter Property="Content" Value="" />
|
||||||
<Setter Property="FontSize"
|
|
||||||
Value="10" />
|
|
||||||
<Setter Property="Content"
|
|
||||||
Value="" />
|
|
||||||
</Style>
|
</Style>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="StandardSliderStyle"
|
<Style
|
||||||
TargetType="Slider"
|
x:Key="StandardSliderStyle"
|
||||||
BasedOn="{StaticResource {x:Type Slider}}">
|
BasedOn="{StaticResource {x:Type Slider}}"
|
||||||
<Setter Property="Background"
|
TargetType="Slider">
|
||||||
Value="{DynamicResource DARKPrimaryTrans4}" />
|
<Setter Property="Background" Value="{DynamicResource DARKPrimaryTrans4}" />
|
||||||
<Setter Property="Foreground"
|
<Setter Property="Foreground" Value="{DynamicResource DARKPrimaryDark}" />
|
||||||
Value="{DynamicResource DARKPrimaryDark}" />
|
<Setter Property="pu:SliderHelper.ThumbShadowColor" Value="{DynamicResource ShadowColor}" />
|
||||||
<Setter Property="pu:SliderHelper.ThumbShadowColor"
|
<Setter Property="pu:SliderHelper.TrackThickness" Value="2.5" />
|
||||||
Value="{DynamicResource ShadowColor}" />
|
<Setter Property="pu:SliderHelper.ThumbBorderBrush" Value="{DynamicResource DARKPrimary}" />
|
||||||
<Setter Property="pu:SliderHelper.TrackThickness"
|
<Setter Property="pu:SliderHelper.ThumbBorderThickness" Value="2.5" />
|
||||||
Value="2.5" />
|
<Setter Property="pu:SliderHelper.CoveredBackground" Value="{DynamicResource DARKPrimary}" />
|
||||||
<Setter Property="pu:SliderHelper.ThumbBorderBrush"
|
<Setter Property="pu:ShadowHelper.ShadowDepth" Value="3" />
|
||||||
Value="{DynamicResource DARKPrimary}" />
|
<Setter Property="pu:ShadowHelper.Direction" Value="270" />
|
||||||
<Setter Property="pu:SliderHelper.ThumbBorderThickness"
|
<Setter Property="pu:ShadowHelper.Opacity" Value="0.5" />
|
||||||
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>
|
||||||
|
|
||||||
<Style x:Key="StandardRadioButtonStyle"
|
<Style
|
||||||
TargetType="RadioButton"
|
x:Key="StandardRadioButtonStyle"
|
||||||
BasedOn="{StaticResource {x:Type RadioButton}}">
|
BasedOn="{StaticResource {x:Type RadioButton}}"
|
||||||
<Setter Property="pu:RadioButtonHelper.CheckedToggleBrush"
|
TargetType="RadioButton">
|
||||||
Value="{DynamicResource DARKPrimary}" />
|
<Setter Property="pu:RadioButtonHelper.CheckedToggleBrush" Value="{DynamicResource DARKPrimary}" />
|
||||||
<Setter Property="pu:RadioButtonHelper.CheckedBorderBrush"
|
<Setter Property="pu:RadioButtonHelper.CheckedBorderBrush" Value="{DynamicResource DARKPrimary}" />
|
||||||
Value="{DynamicResource DARKPrimary}" />
|
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="SideMenuListBoxStyle"
|
<Style
|
||||||
TargetType="ListBox"
|
x:Key="SideMenuListBoxStyle"
|
||||||
BasedOn="{StaticResource {x:Type ListBox}}">
|
BasedOn="{StaticResource {x:Type ListBox}}"
|
||||||
<Setter Property="BorderThickness"
|
TargetType="ListBox">
|
||||||
Value="0" />
|
<Setter Property="BorderThickness" Value="0" />
|
||||||
<Setter Property="Background"
|
<Setter Property="Background" Value="Transparent" />
|
||||||
Value="Transparent" />
|
<Setter Property="pu:ListBoxHelper.ItemsHeight" Value="30" />
|
||||||
<Setter Property="pu:ListBoxHelper.ItemsHeight"
|
<Setter Property="pu:ListBoxHelper.ItemsPadding" Value="15,0" />
|
||||||
Value="30" />
|
<Setter Property="pu:ListBoxHelper.ItemsCornerRadius" Value="5" />
|
||||||
<Setter Property="pu:ListBoxHelper.ItemsPadding"
|
<Setter Property="pu:ListBoxHelper.ItemsHoverBackground" Value="{x:Null}" />
|
||||||
Value="15,0" />
|
<Setter Property="pu:ListBoxHelper.ItemsSelectedBackground" Value="{DynamicResource DARKPrimary}" />
|
||||||
<Setter Property="pu:ListBoxHelper.ItemsCornerRadius"
|
<Setter Property="pu:ListBoxHelper.ItemsSelectedForeground" Value="{DynamicResource DARKPrimaryText}" />
|
||||||
Value="5" />
|
|
||||||
<Setter Property="pu:ListBoxHelper.ItemsHoverBackground"
|
|
||||||
Value="{x:Null}" />
|
|
||||||
<Setter Property="pu:ListBoxHelper.ItemsSelectedBackground"
|
|
||||||
Value="{DynamicResource DARKPrimary}" />
|
|
||||||
<Setter Property="pu:ListBoxHelper.ItemsSelectedForeground"
|
|
||||||
Value="{DynamicResource DARKPrimaryText}" />
|
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="ToolBarMenuStyle"
|
<Style
|
||||||
TargetType="Menu"
|
x:Key="ToolBarMenuStyle"
|
||||||
BasedOn="{StaticResource {x:Type Menu}}">
|
BasedOn="{StaticResource {x:Type Menu}}"
|
||||||
<Setter Property="Height"
|
TargetType="Menu">
|
||||||
Value="55" />
|
<Setter Property="Height" Value="55" />
|
||||||
<Setter Property="FontSize"
|
<Setter Property="FontSize" Value="24" />
|
||||||
Value="24" />
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
<Setter Property="VerticalContentAlignment"
|
<Setter Property="pu:MenuHelper.TopLevelDropDownVerticalOffset" Value="-25" />
|
||||||
Value="Center" />
|
<Setter Property="BorderBrush" Value="{DynamicResource DARKPrimaryDarker}" />
|
||||||
<Setter Property="pu:MenuHelper.TopLevelDropDownVerticalOffset"
|
<Setter Property="Background" Value="{DynamicResource DARKPrimaryText}" />
|
||||||
Value="-25" />
|
<Setter Property="pu:MenuHelper.CornerRadius" Value="5" />
|
||||||
<Setter Property="BorderBrush"
|
<Setter Property="pu:MenuHelper.TopLevelDropDownPlacement" Value="TopRight" />
|
||||||
Value="{DynamicResource DARKPrimaryDarker}" />
|
<Setter Property="pu:MenuHelper.TopLevelItemsPadding" Value="15,0" />
|
||||||
<Setter Property="Background"
|
<Setter Property="pu:MenuHelper.TopLevelItemsBackground" Value="Transparent" />
|
||||||
Value="{DynamicResource DARKPrimaryText}" />
|
<Setter Property="pu:MenuHelper.TopLevelItemsHoverBackground" Value="{DynamicResource SecondaryLighter}" />
|
||||||
<Setter Property="pu:MenuHelper.CornerRadius"
|
<Setter Property="pu:MenuHelper.TopLevelItemsHoverForeground" Value="{DynamicResource DARKPrimary}" />
|
||||||
Value="5" />
|
<Setter Property="pu:MenuHelper.TopLevelItemsOpenedBackground" Value="{DynamicResource SecondaryLighter}" />
|
||||||
<Setter Property="pu:MenuHelper.TopLevelDropDownPlacement"
|
<Setter Property="pu:MenuHelper.TopLevelItemsOpenedForeground" Value="{DynamicResource DARKPrimary}" />
|
||||||
Value="TopRight" />
|
<Setter Property="pu:MenuHelper.SubmenuItemsPadding" Value="15,0" />
|
||||||
<Setter Property="pu:MenuHelper.TopLevelItemsPadding"
|
<Setter Property="pu:MenuHelper.SubmenuItemsHeight" Value="55" />
|
||||||
Value="15,0" />
|
<Setter Property="pu:MenuHelper.SubmenuItemsIconWidth" Value="NaN" />
|
||||||
<Setter Property="pu:MenuHelper.TopLevelItemsBackground"
|
<Setter Property="pu:MenuHelper.SubmenuItemsWidth" Value="200" />
|
||||||
Value="Transparent" />
|
<Setter Property="pu:DropDownHelper.CornerRadius" Value="5" />
|
||||||
<Setter Property="pu:MenuHelper.TopLevelItemsHoverBackground"
|
<Setter Property="pu:MenuHelper.SubmenuItemsBackground" Value="Transparent" />
|
||||||
Value="{DynamicResource SecondaryLighter}" />
|
<Setter Property="pu:MenuHelper.SubmenuItemsHoverBackground" 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"
|
<!--<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.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"
|
<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" />
|
|
||||||
<Setter Property="pu:ShadowHelper.BlurRadius"
|
|
||||||
Value="25" />
|
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
@ -1,4 +1,5 @@
|
|||||||
<Application x:Class="VPet_Simulator.Windows.App"
|
<Application
|
||||||
|
x:Class="VPet_Simulator.Windows.App"
|
||||||
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:local="clr-namespace:VPet_Simulator.Windows"
|
xmlns:local="clr-namespace:VPet_Simulator.Windows"
|
||||||
@ -17,7 +18,8 @@
|
|||||||
</FontFamily>
|
</FontFamily>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<pu:GlobalSettings x:Key="globalSettings"
|
<pu:GlobalSettings
|
||||||
|
x:Key="globalSettings"
|
||||||
FontFamily="{StaticResource MainFont}"
|
FontFamily="{StaticResource MainFont}"
|
||||||
FontSize="14"
|
FontSize="14"
|
||||||
IconFontFamily="/VPet-Simulator.Windows;component/Res/#remixicon"
|
IconFontFamily="/VPet-Simulator.Windows;component/Res/#remixicon"
|
||||||
|
@ -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>
|
52
VPet.Solution/Converters/AllIsBoolConverter.cs
Normal file
52
VPet.Solution/Converters/AllIsBoolConverter.cs
Normal 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));
|
||||||
|
}
|
||||||
|
}
|
97
VPet.Solution/Converters/AllIsBoolToVisibilityConverter.cs
Normal file
97
VPet.Solution/Converters/AllIsBoolToVisibilityConverter.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
63
VPet.Solution/Converters/BoolToVisibilityConverter.cs
Normal file
63
VPet.Solution/Converters/BoolToVisibilityConverter.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
15
VPet.Solution/Converters/ConverterBase/ConverterBase.cs
Normal file
15
VPet.Solution/Converters/ConverterBase/ConverterBase.cs
Normal 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;
|
||||||
|
}
|
32
VPet.Solution/Converters/ConverterBase/HaveRatioConverter.cs
Normal file
32
VPet.Solution/Converters/ConverterBase/HaveRatioConverter.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
@ -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."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
45
VPet.Solution/Converters/ConverterBase/ValueConverterBase.cs
Normal file
45
VPet.Solution/Converters/ConverterBase/ValueConverterBase.cs
Normal 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."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
62
VPet.Solution/Converters/IsBoolConverter.cs
Normal file
62
VPet.Solution/Converters/IsBoolConverter.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
@ -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,20 +15,83 @@ 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)
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (values.Length == 1)
|
||||||
{
|
{
|
||||||
return new Thickness()
|
return new Thickness()
|
||||||
{
|
{
|
||||||
@ -71,14 +134,5 @@ public class MarginConverter : IMultiValueConverter
|
|||||||
else
|
else
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public object[] ConvertBack(
|
|
||||||
object value,
|
|
||||||
Type[] targetTypes,
|
|
||||||
object parameter,
|
|
||||||
System.Globalization.CultureInfo culture
|
|
||||||
)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
22
VPet.Solution/Converters/ValueToBoolConverter.cs
Normal file
22
VPet.Solution/Converters/ValueToBoolConverter.cs
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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" />
|
||||||
|
Loading…
Reference in New Issue
Block a user