更新
This commit is contained in:
158
WPFDark/Controls/BiaColorPicker.xaml
Normal file
158
WPFDark/Controls/BiaColorPicker.xaml
Normal file
@@ -0,0 +1,158 @@
|
||||
<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"
|
||||
xmlns:internals="clr-namespace:WPFDark.Internals">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<internals:SharedResourceDictionary Source="pack://application:,,,/WPFDark;component/Controls/BiaNumberEditor.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style 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:BiaHsvBoxBackground 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:BiaHsvBoxCursor 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" />
|
||||
<Setter Property="IsReadOnly" Value="{Binding IsReadOnly, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}" />
|
||||
</Style>
|
||||
</colorPicker:BiaUniformGrid.Resources>
|
||||
|
||||
<colorPicker:BiaNumberEditor x:Name="RedEditor"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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" />
|
||||
<Setter Property="IsReadOnly" Value="{Binding IsReadOnly, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}" />
|
||||
</Style>
|
||||
</colorPicker:BiaUniformGrid.Resources>
|
||||
|
||||
<colorPicker:BiaNumberEditor x:Name="HueEditor" Value="{Binding Hue, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}" />
|
||||
<colorPicker:BiaNumberEditor x:Name="SaturationEditor" Value="{Binding Saturation, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type colorPicker:BiaColorPicker}}}" />
|
||||
<colorPicker:BiaNumberEditor x:Name="ValueEditor" 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>
|
||||
Reference in New Issue
Block a user