Files
Shrlalgo.RvKits/WPFDark/Controls/BiaColorPickerWheelStyle.xaml
ShrlAlgo 4d35cadb56 更新
2025-07-11 09:20:23 +08:00

161 lines
14 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wpf="clr-namespace:WPFDark"
xmlns:colorPicker="clr-namespace:WPFDark.Controls">
<Style x:Key="BiaColorPickerWheelStyle" TargetType="{x:Type colorPicker:BiaColorPicker}">
<Setter Property="MinHeight" Value="160" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="4" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<colorPicker:BiaHsvWheelBackground Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="3"
Margin="0,0,28,0"
Hue="{Binding Hue, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
IsReadOnly="{Binding IsReadOnly, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Saturation="{Binding Saturation, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Value="{Binding Value, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}" />
<colorPicker:BiaHsvWheelCursor Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="3"
Margin="0,0,28,0"
Hue="{Binding Hue, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
IsReadOnly="{Binding IsReadOnly, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Saturation="{Binding Saturation, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}" />
<colorPicker:BiaColorBar Grid.Row="0"
Grid.Column="2"
Width="{x:Static wpf:Boxes.BasicOneLineHeight}"
HorizontalAlignment="Right"
IsInverseValue="True"
IsReadOnly="{Binding IsReadOnly, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Value="{Binding Value, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}" />
<colorPicker:BiaClippingBorder Grid.Row="1"
Grid.Column="0"
Margin="0,4,0,0"
Background="{DynamicResource TextBoxBorderBrushKey}"
BorderBrush="{DynamicResource TextBoxBorderBrushKey}"
BorderThickness="1">
<colorPicker:BiaClippingBorder.CornerRadius>
<CornerRadius BottomLeft="{x:Static wpf:Boxes.GroupCornerRadiusPrim}"
BottomRight="0.0"
TopLeft="0.0"
TopRight="0.0" />
</colorPicker:BiaClippingBorder.CornerRadius>
<colorPicker:BiaUniformGrid Columns="1">
<colorPicker:BiaUniformGrid.Resources>
<Style BasedOn="{StaticResource {x:Type colorPicker:BiaNumberEditor}}" TargetType="{x:Type colorPicker:BiaNumberEditor}">
<Setter Property="SliderMinimum" Value="0.0" />
<Setter Property="SliderMaximum" Value="1.0" />
<Setter Property="Increment" Value="0.1" />
<Setter Property="CornerRadius" Value="0.0" />
<Setter Property="IsVisibleBorder" Value="False" />
</Style>
</colorPicker:BiaUniformGrid.Resources>
<colorPicker:BiaNumberEditor x:Name="RedEditor"
IsReadOnly="{Binding IsReadOnly, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Maximum="{Binding RedMaximum, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Minimum="{Binding RedMinimum, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Value="{Binding Red, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}" />
<colorPicker:BiaNumberEditor x:Name="GreenEditor"
IsReadOnly="{Binding IsReadOnly, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Maximum="{Binding GreenMaximum, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Minimum="{Binding GreenMinimum, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Value="{Binding Green, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}" />
<colorPicker:BiaNumberEditor x:Name="BlueEditor"
IsReadOnly="{Binding IsReadOnly, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Maximum="{Binding BlueMaximum, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Minimum="{Binding BlueMinimum, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Value="{Binding Blue, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}" />
<colorPicker:BiaNumberEditor x:Name="AlphaEditor"
IsReadOnly="{Binding IsReadOnly, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Maximum="{Binding AlphaMaximum, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Minimum="{Binding AlphaMinimum, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Value="{Binding Alpha, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}">
<colorPicker:BiaNumberEditor.Style>
<Style BasedOn="{StaticResource {x:Type colorPicker:BiaNumberEditor}}" TargetType="{x:Type colorPicker:BiaNumberEditor}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsVisibleAlphaEditor, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}" Value="False">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</colorPicker:BiaNumberEditor.Style>
</colorPicker:BiaNumberEditor>
</colorPicker:BiaUniformGrid>
</colorPicker:BiaClippingBorder>
<colorPicker:BiaClippingBorder Grid.Row="1"
Grid.Column="2"
Margin="0,4,0,0"
Background="{DynamicResource TextBoxBorderBrushKey}"
BorderBrush="{DynamicResource TextBoxBorderBrushKey}"
BorderThickness="1">
<colorPicker:BiaClippingBorder.CornerRadius>
<CornerRadius BottomLeft="0.0"
BottomRight="{x:Static wpf:Boxes.GroupCornerRadiusPrim}"
TopLeft="0.0"
TopRight="0.0" />
</colorPicker:BiaClippingBorder.CornerRadius>
<colorPicker:BiaUniformGrid Columns="1">
<colorPicker:BiaUniformGrid.Resources>
<Style BasedOn="{StaticResource {x:Type colorPicker:BiaNumberEditor}}" TargetType="{x:Type colorPicker:BiaNumberEditor}">
<Setter Property="Minimum" Value="0.0" />
<Setter Property="Maximum" Value="1.0" />
<Setter Property="SliderMinimum" Value="0.0" />
<Setter Property="SliderMaximum" Value="1.0" />
<Setter Property="Increment" Value="0.1" />
<Setter Property="CornerRadius" Value="0.0" />
<Setter Property="IsVisibleBorder" Value="False" />
</Style>
</colorPicker:BiaUniformGrid.Resources>
<colorPicker:BiaNumberEditor x:Name="HueEditor"
IsReadOnly="{Binding IsReadOnly, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Value="{Binding Hue, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}" />
<colorPicker:BiaNumberEditor x:Name="SaturationEditor"
IsReadOnly="{Binding IsReadOnly, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Value="{Binding Saturation, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}" />
<colorPicker:BiaNumberEditor x:Name="ValueEditor"
IsReadOnly="{Binding IsReadOnly, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}"
Value="{Binding Value, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}" />
<Canvas Height="{Binding ActualHeight, ElementName=HueEditor}" Background="{DynamicResource BackgroundBackgroundBrushKey}">
<Canvas.Style>
<Style TargetType="{x:Type Canvas}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsVisibleAlphaEditor, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}" Value="False">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</Canvas.Style>
</Canvas>
</colorPicker:BiaUniformGrid>
</colorPicker:BiaClippingBorder>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>