Skip to content

Commit

Permalink
Enhanced Dark/Light themes and demo controls and replaced repeatbutto…
Browse files Browse the repository at this point in the history
…ns with updownnumericcontrollib from nuget
  • Loading branch information
Dirkster99 committed Aug 17, 2018
1 parent 875ab80 commit 051641e
Show file tree
Hide file tree
Showing 21 changed files with 300 additions and 111 deletions.
4 changes: 2 additions & 2 deletions source/ColorPickerDemo/ColorPickerDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="NumericUpDownLib, Version=1.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dirkster.NumericUpDownLib.1.0.3\lib\net4\NumericUpDownLib.dll</HintPath>
<Reference Include="NumericUpDownLib, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dirkster.NumericUpDownLib.1.1.0\lib\net4\NumericUpDownLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
Expand Down
2 changes: 1 addition & 1 deletion source/ColorPickerDemo/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Dirkster.NumericUpDownLib" version="1.0.3" targetFramework="net45" />
<package id="Dirkster.NumericUpDownLib" version="1.1.0" targetFramework="net45" />
</packages>
4 changes: 2 additions & 2 deletions source/ColorPickerLib/ColorPickerLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="NumericUpDownLib, Version=1.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dirkster.NumericUpDownLib.1.0.3\lib\net4\NumericUpDownLib.dll</HintPath>
<Reference Include="NumericUpDownLib, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dirkster.NumericUpDownLib.1.1.0\lib\net4\NumericUpDownLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
Expand Down
30 changes: 21 additions & 9 deletions source/ColorPickerLib/Controls/ColorCanvas.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -258,17 +258,22 @@
<!-- behaviour allows only characters that conform to hexadecimal input -->
<TextBox x:Name="PART_HexadecimalTextBox"
Grid.Column="1"
Margin="3"
VerticalAlignment="Center"
Margin="3,9,3,3"
Padding="3"
MaxLength="8"
Style="{StaticResource ColorCanvasTextBoxStyle}"
AcceptsReturn="False"
FontFamily="Courier New"
TextWrapping="NoWrap"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
behav:AllowableCharactersTextBoxBehavior.RegularExpressionProperty="^[0-9|a-f|A-F]+$"
/>

<TextBlock Grid.Column="1"
Margin="3"
Margin="3,9,3,3"
FontFamily="Courier New"
TextWrapping="NoWrap"
VerticalAlignment="Center"
Style="{StaticResource ColorCanvasTextBlockStyle}"
Text="#XXXXXXXXX"
Visibility="Hidden" />
<!-- Size Measuring TextBlock -->
Expand Down Expand Up @@ -326,10 +331,11 @@
Value="{Binding R, RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
MinValue="0"
MaxValue="255" />
MaxValue="255"
IsReadOnly="False"
/>
<TextBlock Grid.Row="1" Grid.Column="1"
VerticalAlignment="Center"
Style="{StaticResource ColorCanvasTextBlockStyle}"
Text="XXXX"
Visibility="Hidden" />
<!-- Size Measuring TextBlock -->
Expand All @@ -349,11 +355,14 @@
Margin="3,6,3,6"
Value="{Binding G, RelativeSource={RelativeSource TemplatedParent}}"
VerticalAlignment="Center" />

<numupdown:NumericUpDown Grid.Row="3" Grid.Column="1"
Value="{Binding G, RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
MinValue="0"
MaxValue="255" />
MaxValue="255"
IsReadOnly="False"
/>

<TextBlock Grid.Row="4" Grid.Column="0"
Text="{Binding Source={x:Static localiz:Strings.STR_BLUE_LABEL}, StringFormat={}{0}:}"
Expand All @@ -372,7 +381,9 @@
Value="{Binding B, RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
MinValue="0"
MaxValue="255" />
MaxValue="255"
IsReadOnly="False"
/>

<TextBlock Grid.Row="6" Grid.Column="0"
Text="{Binding Source={x:Static localiz:Strings.STR_ALPHA_LABEL}, StringFormat={}{0}:}"
Expand All @@ -395,6 +406,7 @@
MinValue="0"
MaxValue="255"
Visibility="{Binding Path=UsingAlphaChannel, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}"
IsReadOnly="False"
/>
</Grid>
</Border>
Expand Down
11 changes: 3 additions & 8 deletions source/ColorPickerLib/Controls/ColorCanvasTextBoxStyle.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,14 @@
<!-- ColorCanvasTextBox (Style) -->
<!-- =============================================================================== -->

<Style x:Key="ColorCanvasTextBoxStyle"
<!-- Style x:Key="ColorCanvasTextBoxStyle"
TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontFamily" Value="Courier New" />
<Setter Property="AcceptsReturn" Value="False" />
<Setter Property="TextWrapping" Value="NoWrap" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Style.Triggers>
<Trigger Property="IsFocused" Value="False">
<Setter Property="BorderBrush" Value="Transparent" />
</Trigger>
</Style.Triggers>
</Style>
<Setter Property="VerticalAlignment" Value="Center" />
</Style -->

<Style x:Key="ColorCanvasTextBlockStyle"
TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
Expand Down
6 changes: 4 additions & 2 deletions source/ColorPickerLib/Controls/ColorPicker.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,10 @@
Focusable="False"
HorizontalOffset="0" VerticalOffset="3" PopupAnimation="None"
>
<Border BorderThickness="1"
<Border BorderThickness="1" x:Name="PopUpBorder"
Background="{DynamicResource PopupBackgroundBrush}"
BorderBrush="{DynamicResource ColorPickerDarkBorderBrush}" Padding="3">
BorderBrush="{DynamicResource ColorPickerDarkBorderBrush}"
Padding="3">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
Expand Down Expand Up @@ -310,6 +311,7 @@
</Trigger>
<Trigger Property="IsOpen" Value="True">
<Setter TargetName="PART_ColorPickerToggleButton" Property="BorderBrush" Value="{DynamicResource {x:Static themes:ResourceKeys.ButtonPressedInnerBorderKey}}" />
<Setter TargetName="PopUpBorder" Property="BorderBrush" Value="{DynamicResource {x:Static themes:ResourceKeys.PopUpOpenBorderBrushKey}}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
Expand Down
5 changes: 2 additions & 3 deletions source/ColorPickerLib/Controls/ColorSpectrumSlider.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@
BorderThickness="{TemplateBinding BorderThickness}"
Background="Transparent"
Margin="0,0,0,0">
<Border x:Name="PART_TrackBackground" Width="25">
<Border x:Name="PART_TrackBackground" MinWidth="24">
<Rectangle x:Name="PART_SpectrumDisplay"
Stretch="Fill"
VerticalAlignment="Stretch" />
</Border>
</Border>

<Track Name="PART_Track"
>
<Track Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Style="{StaticResource SliderRepeatButtonStyle}"
Command="Slider.DecreaseLarge" />
Expand Down
83 changes: 59 additions & 24 deletions source/ColorPickerLib/Controls/VerticalSlideThumbTemplate.xaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,75 @@
<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:reskeys="clr-namespace:ColorPickerLib.Themes"
>

<!-- =============================================================================== -->
<!-- VerticalSlideThumb (Template and Style) -->
<!-- =============================================================================== -->

<ControlTemplate x:Key="VerticalSlideThumbTemplate" TargetType="{x:Type Thumb}">
<Canvas SnapsToDevicePixels="true">
<Path x:Name="LeftArrow" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF000000" Fill="#FF000000" Data="F1 M 276.761,316L 262.619,307.835L 262.619,324.165L 276.761,316 Z " RenderTransformOrigin="0.5,0.5" Width="6" Height="8">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform />
<TranslateTransform Y="6" X="-3" />
</TransformGroup>
</Path.RenderTransform>
</Path>
<Path x:Name="RightArrow" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF000000" Fill="#FF000000" Data="F1 M 276.761,316L 262.619,307.835L 262.619,324.165L 276.761,316 Z " RenderTransformOrigin="0.5,0.5" Width="6" Height="8">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform Angle="-180" />
<TranslateTransform Y="6" X="8" />
</TransformGroup>
</Path.RenderTransform>
</Path>
<Canvas SnapsToDevicePixels="true"
UseLayoutRounding="True"
Background="Transparent"
>
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Center"
MinHeight="9"
Width="27">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="3" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<Path x:Name="LeftArrow" Grid.Column="0"
Stretch="Uniform"
Stroke="#FF000000" StrokeThickness="2"
Fill="#FF000000"
Data="F1 M 276.761,316L 262.619,307.835L 262.619,324.165L 276.761,316 Z "
RenderTransformOrigin="0.5,0.5"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform />
<!-- TranslateTransform Y="6" X="8" /-->
</TransformGroup>
</Path.RenderTransform>
</Path>
<Path x:Name="RightArrow" Grid.Column="2"
Stretch="Uniform"
Stroke="#FF000000" StrokeThickness="2"
Fill="#FF000000"
Data="F1 M 276.761,316L 262.619,307.835L 262.619,324.165L 276.761,316 Z "
RenderTransformOrigin="0.5,0.5"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform Angle="-180" />
<!-- TranslateTransform Y="6" X="8" /-->
</TransformGroup>
</Path.RenderTransform>
</Path>
</Grid>
</Canvas>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="RightArrow" Property="Stroke" Value="{DynamicResource {x:Static reskeys:ResourceKeys.VerticalSLideThumbMouseOverBrushKey}}" />
<Setter TargetName="LeftArrow" Property="Stroke" Value="{DynamicResource {x:Static reskeys:ResourceKeys.VerticalSLideThumbMouseOverBrushKey}}" />
<Setter TargetName="RightArrow" Property="Fill" Value="{DynamicResource {x:Static reskeys:ResourceKeys.VerticalSLideThumbMouseOverBrushKey}}" />
<Setter TargetName="LeftArrow" Property="Fill" Value="{DynamicResource {x:Static reskeys:ResourceKeys.VerticalSLideThumbMouseOverBrushKey}}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>

<Style x:Key="VerticalSlideThumbStyle" TargetType="{x:Type Thumb}">
<Setter Property="Focusable" Value="false" />
<Setter Property="OverridesDefaultStyle" Value="true" />
<Setter Property="Height" Value="12" />
<Setter Property="Width" Value="11" />
<Setter Property="Foreground" Value="Gray" />
<Setter Property="Template" Value="{StaticResource VerticalSlideThumbTemplate}" />
</Style>
Expand Down
4 changes: 2 additions & 2 deletions source/ColorPickerLib/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
Loading

0 comments on commit 051641e

Please sign in to comment.