更新
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:WPFluent.Converters"
|
||||
xmlns:controls="clr-namespace:WPFluent.Controls"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib">
|
||||
xmlns:converters="clr-namespace:WPFluent.Converters"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/WPFluent;component/Resources/Variables.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
@@ -15,7 +15,7 @@
|
||||
<!--<converters:BooleanToVisConverter x:Key="BooleanToVisibility" />-->
|
||||
<converters:DoubleToPercentageConverter x:Key="DoubleToPercentageConverter" />
|
||||
<!-- 滑动条两侧的按钮 -->
|
||||
<Style x:Key="ColorRepeatButton" TargetType="{x:Type RepeatButton}">
|
||||
<Style TargetType="{x:Type RepeatButton}" x:Key="ColorRepeatButton">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
@@ -29,17 +29,17 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
<!-- 滑动条的滑块 -->
|
||||
<ControlTemplate x:Key="ColorSliderThumb" TargetType="{x:Type Thumb}">
|
||||
<ControlTemplate TargetType="{x:Type Thumb}" x:Key="ColorSliderThumb">
|
||||
<Grid
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
UseLayoutRounding="True">
|
||||
UseLayoutRounding="True"
|
||||
VerticalAlignment="Center">
|
||||
<Ellipse
|
||||
Width="10"
|
||||
Height="10"
|
||||
Fill="{DynamicResource SolidBackgroundFillColorBaseBrush}"
|
||||
Height="10"
|
||||
RenderTransformOrigin=".5,.5"
|
||||
UseLayoutRounding="True" />
|
||||
UseLayoutRounding="True"
|
||||
Width="10" />
|
||||
<!--<Ellipse
|
||||
x:Name="shadow"
|
||||
Width="14"
|
||||
@@ -49,12 +49,12 @@
|
||||
Opacity=".0"
|
||||
UseLayoutRounding="True" />-->
|
||||
<Ellipse
|
||||
x:Name="grip"
|
||||
Width="8"
|
||||
Height="8"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Height="8"
|
||||
RenderTransformOrigin=".5,.5"
|
||||
UseLayoutRounding="True">
|
||||
UseLayoutRounding="True"
|
||||
Width="8"
|
||||
x:Name="grip">
|
||||
<Ellipse.RenderTransform>
|
||||
<ScaleTransform ScaleX="1" ScaleY="1" />
|
||||
</Ellipse.RenderTransform>
|
||||
@@ -150,15 +150,15 @@
|
||||
</Trigger.ExitActions>
|
||||
</Trigger>-->
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter TargetName="grip" Property="Fill" Value="{DynamicResource ControlFillColorDisabledBrush}" />
|
||||
<Setter TargetName="grip" Property="Stroke" Value="{DynamicResource ControlStrongStrokeColorDisabledBrush}" />
|
||||
<Setter Property="Fill" TargetName="grip" Value="{DynamicResource ControlFillColorDisabledBrush}" />
|
||||
<Setter Property="Stroke" TargetName="grip" Value="{DynamicResource ControlStrongStrokeColorDisabledBrush}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
<!-- 色相水平滑动条控件模板 -->
|
||||
|
||||
<!-- 颜色滑动条 -->
|
||||
<Style x:Key="ColorSlider" TargetType="{x:Type Slider}">
|
||||
<Style TargetType="{x:Type Slider}" x:Key="ColorSlider">
|
||||
<Setter Property="Background" Value="{x:Null}" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="Maximum" Value="360" />
|
||||
@@ -168,11 +168,11 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Slider}">
|
||||
<Border
|
||||
x:Name="border"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
SnapsToDevicePixels="True">
|
||||
SnapsToDevicePixels="True"
|
||||
x:Name="border">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -180,26 +180,26 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border
|
||||
CornerRadius="4"
|
||||
Grid.Row="1"
|
||||
Height="8"
|
||||
CornerRadius="4">
|
||||
Height="8">
|
||||
<Border.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
|
||||
<GradientStop Offset="0" Color="#FF0000" />
|
||||
<GradientStop Offset="0.166" Color="#FFFF00" />
|
||||
<GradientStop Offset="0.333" Color="#00FF00" />
|
||||
<GradientStop Offset="0.5" Color="#00FFFF" />
|
||||
<GradientStop Offset="0.666" Color="#0000FF" />
|
||||
<GradientStop Offset="0.833" Color="#FF00FF" />
|
||||
<GradientStop Offset="1.0" Color="#FF0000" />
|
||||
<LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
|
||||
<GradientStop Color="#FF0000" Offset="0" />
|
||||
<GradientStop Color="#FFFF00" Offset="0.166" />
|
||||
<GradientStop Color="#00FF00" Offset="0.333" />
|
||||
<GradientStop Color="#00FFFF" Offset="0.5" />
|
||||
<GradientStop Color="#0000FF" Offset="0.666" />
|
||||
<GradientStop Color="#FF00FF" Offset="0.833" />
|
||||
<GradientStop Color="#FF0000" Offset="1.0" />
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<!-- 滑动条轨道 -->
|
||||
<Track
|
||||
x:Name="PART_Track"
|
||||
Grid.Row="1"
|
||||
OpacityMask="{x:Null}">
|
||||
OpacityMask="{x:Null}"
|
||||
x:Name="PART_Track">
|
||||
<!-- 滑块左侧 -->
|
||||
<Track.DecreaseRepeatButton>
|
||||
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource ColorRepeatButton}" />
|
||||
@@ -210,13 +210,13 @@
|
||||
</Track.IncreaseRepeatButton>
|
||||
<Track.Thumb>
|
||||
<Thumb
|
||||
x:Name="Thumb"
|
||||
Width="{DynamicResource ThumbSize}"
|
||||
Height="{DynamicResource ThumbSize}"
|
||||
VerticalAlignment="Center"
|
||||
Focusable="False"
|
||||
Height="{DynamicResource ThumbSize}"
|
||||
OverridesDefaultStyle="True"
|
||||
Template="{StaticResource ColorSliderThumb}">
|
||||
Template="{StaticResource ColorSliderThumb}"
|
||||
VerticalAlignment="Center"
|
||||
Width="{DynamicResource ThumbSize}"
|
||||
x:Name="Thumb">
|
||||
<Thumb.Foreground>
|
||||
<MultiBinding Converter="{StaticResource HsbToColorConverter}">
|
||||
<Binding Path="Value" RelativeSource="{RelativeSource TemplatedParent}" />
|
||||
@@ -247,7 +247,7 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<!-- 透明度滑动条 -->
|
||||
<Style x:Key="AlphaSlider" TargetType="{x:Type Slider}">
|
||||
<Style TargetType="{x:Type Slider}" x:Key="AlphaSlider">
|
||||
<Setter Property="Background" Value="{x:Null}" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="Maximum" Value="1" />
|
||||
@@ -256,11 +256,11 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Slider}">
|
||||
<Border
|
||||
x:Name="border"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
SnapsToDevicePixels="True">
|
||||
SnapsToDevicePixels="True"
|
||||
x:Name="border">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -268,9 +268,9 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border
|
||||
CornerRadius="4"
|
||||
Grid.Row="1"
|
||||
Height="8"
|
||||
CornerRadius="4">
|
||||
Height="8">
|
||||
<Border.Background>
|
||||
<DrawingBrush
|
||||
Stretch="Uniform"
|
||||
@@ -302,21 +302,21 @@
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<Border
|
||||
CornerRadius="4"
|
||||
Grid.Row="1"
|
||||
Height="8"
|
||||
CornerRadius="4">
|
||||
Height="8">
|
||||
<Border.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
|
||||
<GradientStop Offset="0" Color="Transparent" />
|
||||
<GradientStop Offset="1.0" Color="{Binding SelectedColor, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:ColorPicker}, Mode=OneWay, Converter={StaticResource ActualColorConverter}}" />
|
||||
<LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
|
||||
<GradientStop Color="Transparent" Offset="0" />
|
||||
<GradientStop Color="{Binding SelectedColor, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:ColorPicker}, Mode=OneWay, Converter={StaticResource ActualColorConverter}}" Offset="1.0" />
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
<!-- 滑动条轨道 -->
|
||||
<Track
|
||||
x:Name="PART_Track"
|
||||
Grid.Row="1"
|
||||
OpacityMask="{x:Null}">
|
||||
OpacityMask="{x:Null}"
|
||||
x:Name="PART_Track">
|
||||
<!-- 滑块左侧 -->
|
||||
<Track.DecreaseRepeatButton>
|
||||
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource ColorRepeatButton}" />
|
||||
@@ -327,14 +327,14 @@
|
||||
</Track.IncreaseRepeatButton>
|
||||
<Track.Thumb>
|
||||
<Thumb
|
||||
x:Name="Thumb"
|
||||
Width="{DynamicResource ThumbSize}"
|
||||
Height="{DynamicResource ThumbSize}"
|
||||
VerticalAlignment="Center"
|
||||
Focusable="False"
|
||||
Foreground="{DynamicResource TextControlForeground}"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||
Height="{DynamicResource ThumbSize}"
|
||||
OverridesDefaultStyle="True"
|
||||
Template="{StaticResource ColorSliderThumb}" />
|
||||
Template="{StaticResource ColorSliderThumb}"
|
||||
VerticalAlignment="Center"
|
||||
Width="{DynamicResource ThumbSize}"
|
||||
x:Name="Thumb" />
|
||||
</Track.Thumb>
|
||||
</Track>
|
||||
</Grid>
|
||||
@@ -380,32 +380,32 @@
|
||||
RadiusX="{DynamicResource ColorPickerRadius}"
|
||||
RadiusY="{DynamicResource ColorPickerRadius}">
|
||||
<Rectangle.OpacityMask>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Offset="0" Color="Transparent" />
|
||||
<GradientStop Offset="1.0" Color="Black" />
|
||||
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="Transparent" Offset="0" />
|
||||
<GradientStop Color="Black" Offset="1.0" />
|
||||
</LinearGradientBrush>
|
||||
</Rectangle.OpacityMask>
|
||||
</Rectangle>
|
||||
<!-- 饱和度亮度拾取 -->
|
||||
<Canvas
|
||||
Name="PART_SaturationBrightnessPicker"
|
||||
Background="Transparent"
|
||||
ClipToBounds="True"
|
||||
Focusable="True">
|
||||
Focusable="True"
|
||||
Name="PART_SaturationBrightnessPicker">
|
||||
<!-- 滑块 -->
|
||||
<Thumb
|
||||
Name="PART_SaturationBrightnessPickerThumb"
|
||||
Canvas.Left="20"
|
||||
Canvas.Top="20">
|
||||
Canvas.Top="20"
|
||||
Name="PART_SaturationBrightnessPickerThumb">
|
||||
<Thumb.Template>
|
||||
<ControlTemplate>
|
||||
<Ellipse
|
||||
Width="{DynamicResource ThumbSize}"
|
||||
Fill="Transparent"
|
||||
Height="{DynamicResource ThumbSize}"
|
||||
Margin="{DynamicResource ThumbMargin}"
|
||||
Fill="Transparent"
|
||||
Stroke="{DynamicResource TextControlForeground}"
|
||||
StrokeThickness="1" />
|
||||
Stroke="{DynamicResource TextFillColorPrimaryBrush}"
|
||||
StrokeThickness="1"
|
||||
Width="{DynamicResource ThumbSize}" />
|
||||
</ControlTemplate>
|
||||
</Thumb.Template>
|
||||
</Thumb>
|
||||
@@ -413,32 +413,37 @@
|
||||
</Grid>
|
||||
<!-- 实际选中颜色 -->
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Width="50"
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Background="{Binding SelectedColor, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ColorToBrushConverter}, Mode=OneWay}"
|
||||
CornerRadius="{DynamicResource ControlCornerRadius}" />
|
||||
CornerRadius="{DynamicResource ControlCornerRadius}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Width="50" />
|
||||
<!-- 色相滑动条 -->
|
||||
<Slider
|
||||
x:Name="PART_HueSlider"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Grid.Row="1"
|
||||
IsMoveToPointEnabled="True"
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Orientation="Horizontal"
|
||||
Style="{StaticResource ColorSlider}"
|
||||
Value="{Binding Hue, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
Value="{Binding Hue, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
x:Name="PART_HueSlider" />
|
||||
<Slider
|
||||
x:Name="PART_AlphaSlider"
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Grid.Row="2"
|
||||
IsMoveToPointEnabled="True"
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Orientation="Horizontal"
|
||||
Style="{StaticResource AlphaSlider}"
|
||||
Value="{Binding Alpha, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Grid Grid.Row="3" Grid.ColumnSpan="2">
|
||||
Value="{Binding Alpha, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
x:Name="PART_AlphaSlider" />
|
||||
<Grid
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
@@ -448,51 +453,50 @@
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>-->
|
||||
<StackPanel Grid.Row="0" Grid.Column="0">
|
||||
<StackPanel Grid.Column="0" Grid.Row="0">
|
||||
<controls:TextBoxEx
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Header="红色"
|
||||
HeaderPlacement="Left"
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Text="{Binding Red, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, StringFormat={}{0:F0}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<controls:TextBoxEx
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Header="绿色"
|
||||
HeaderPlacement="Left"
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Text="{Binding Green, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, StringFormat={}{0:F0}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<controls:TextBoxEx
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Header="蓝色"
|
||||
HeaderPlacement="Left"
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Text="{Binding Blue, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, StringFormat={}{0:F0}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<controls:TextBoxEx
|
||||
Grid.Row="2"
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Header="不透明度"
|
||||
HeaderPlacement="Left"
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Text="{Binding Alpha, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, Converter={StaticResource DoubleToPercentageConverter}, StringFormat={}{0}%, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1">
|
||||
<StackPanel Grid.Column="1" Grid.Row="0">
|
||||
<controls:TextBoxEx
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Header="色相"
|
||||
HeaderPlacement="Left"
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Text="{Binding Hue, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, StringFormat={}{0:F0}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<controls:TextBoxEx
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Header="饱和度"
|
||||
HeaderPlacement="Left"
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Text="{Binding Saturation, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, Converter={StaticResource DoubleToPercentageConverter}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<controls:TextBoxEx
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Header="亮度"
|
||||
HeaderPlacement="Left"
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Text="{Binding Brightness, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, Converter={StaticResource DoubleToPercentageConverter}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<controls:TextBoxEx
|
||||
Width="170"
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Header="十六进制"
|
||||
Header="ARGB"
|
||||
HeaderPlacement="Left"
|
||||
Text="{Binding SelectedColor, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToColorConverter}, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, StringFormat='{}{0:X6}'}" />
|
||||
Margin="{StaticResource ControlMargin}"
|
||||
Text="{Binding SelectedColor, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource StringToColorConverter}, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, StringFormat='{}{0:X6}'}"
|
||||
Width="170" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
Reference in New Issue
Block a user