Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

WPF Color Picker Construction Kit

, 26 Dec 2010
A WPF color picker (like Adobe's) constructed in a modular fashion for easy modification.
ColorPickerDemo.zip
ColorPicker.dll
ColorPickerControls.dll
ColorPickerDemo.exe
ColorPickerSource.zip
ColorPickerDemo
ColorPicker
ColorModels
CMY
CMYK
HSB
Lab
RGB
ExtensionMethods
Properties
Settings.settings
Resources
ColorPickerControls
Chips
Dialogs
Pickers
Properties
Settings.settings
ColorPickerDemo
ColorPickerDemo.ico
Properties
Settings.settings
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <LinearGradientBrush x:Key="BrightnessGradient" StartPoint="0,1" EndPoint="0,0" 
        ColorInterpolationMode="ScRgbLinearInterpolation">
        <GradientStop Offset="0" Color="sc# 1, 0,0,0" />
        <GradientStop Offset="0.5" Color="sc# 1, 0.5,0.5,0.5" />
        <GradientStop Offset="1" Color="sc# 1, 1,1,1" />
    </LinearGradientBrush>
    <SolidColorBrush x:Key="HorizontalSliderTrackNormalBackground" Color="#FFF0EDE0"/>
    <LinearGradientBrush x:Key="HorizontalSliderTrackNormalBorder" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#FFAEB1AF" Offset="0.1"/>
        <GradientStop Color="White" Offset=".9"/>
    </LinearGradientBrush>
    <Style x:Key="SliderRepeatButtonStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="Transparent"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <SolidColorBrush x:Key="SliderThumbBackground" Color="#F3F3EF"/>
    <Geometry x:Key="SliderThumbOuterBorderGeometry">M 5,-9 A 1.5 1.5 0 0 0 3.5,-10.5 L -3.5,-10.5 A 1.5 1.5 0 0 0 -5,-9 L -5,9 A 1.5 1.5 0 0 0 -3.5,10.5 L 3.5,10.5 A 1.5 1.5 0 0 0 5,9 Z</Geometry>
    <LinearGradientBrush x:Key="HorizontalSliderThumbTopAccent" EndPoint="1,1" StartPoint="0,0">
        <GradientStop Color="#70D66F" Offset="0"/>
        <GradientStop Color="#46CA44" Offset="1"/>
    </LinearGradientBrush>
    <Geometry x:Key="SliderThumbTopAccentGeometry">M 4.5,-8 L 4.5,-10 L -4.5,-10 L -4.5,-8 Z</Geometry>
    <LinearGradientBrush x:Key="HorizontalSliderThumbBottomAccent" EndPoint="1,1" StartPoint="0,0">
        <GradientStop Color="#46CA44" Offset="0"/>
        <GradientStop Color="#1B9B1A" Offset=".8"/>
    </LinearGradientBrush>
    <Geometry x:Key="SliderThumbBottomAccentGeometry">M 4.5,8 L 4.5,10 L -4.5,10 L -4.5,8 Z</Geometry>
    <LinearGradientBrush x:Key="HorizontalSliderThumbShadeGradient" EndPoint="1,0" StartPoint="0,0">
        <GradientStop Color="#40FFFFFF" Offset="0"/>
        <GradientStop Color="#00FFFFFF" Offset=".3"/>
        <GradientStop Color="#00000000" Offset=".7"/>
        <GradientStop Color="#40000000" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="HorizontalSliderThumbBorder" EndPoint="1,1" StartPoint="0,0">
        <GradientStop Color="#FFBECBD3" Offset="0"/>
        <GradientStop Color="#FF72838D" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="HorizontalSliderThumbTopAccentHover" EndPoint="1,1" StartPoint="0,0">
        <GradientStop Color="#FBCE7C" Offset="0"/>
        <GradientStop Color="#F7B335" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="HorizontalSliderThumbBottomAccentHover" EndPoint="1,1" StartPoint="0,0">
        <GradientStop Color="#FAC055" Offset="0"/>
        <GradientStop Color="#C7902A" Offset=".8"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="HorizontalSliderThumbTopAccentPressed" EndPoint="1,1" StartPoint="0,0">
        <GradientStop Color="#70BA66" Offset="0"/>
        <GradientStop Color="#229412" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="HorizontalSliderThumbBottomAccentPressed" EndPoint="1,1" StartPoint="0,0">
        <GradientStop Color="#46A638" Offset="0"/>
        <GradientStop Color="#1B770E" Offset=".8"/>
    </LinearGradientBrush>
    <Style x:Key="HorizontalSliderThumbStyle" TargetType="{x:Type Thumb}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Height" Value="22"/>
        <Setter Property="Width" Value="11"/>
        <Setter Property="Foreground" Value="Green"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Canvas SnapsToDevicePixels="true">
                        <Canvas.RenderTransform>
                            <TranslateTransform X="5.5" Y="11"/>
                        </Canvas.RenderTransform>
                        <Path x:Name="Background" Fill="{StaticResource SliderThumbBackground}" Data="{StaticResource SliderThumbOuterBorderGeometry}"/>
                        <Path x:Name="TopAccent" Fill="{StaticResource HorizontalSliderThumbTopAccent}" StrokeThickness="1" Data="{StaticResource SliderThumbTopAccentGeometry}"/>
                        <Path x:Name="BottomAccent" Fill="{StaticResource HorizontalSliderThumbBottomAccent}" StrokeThickness="1" Data="{StaticResource SliderThumbBottomAccentGeometry}"/>
                        <Path x:Name="OuterBorder" Fill="{StaticResource HorizontalSliderThumbShadeGradient}" Stroke="{StaticResource HorizontalSliderThumbBorder}" StrokeThickness="1" Data="{StaticResource SliderThumbOuterBorderGeometry}"/>
                      
                    </Canvas>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Fill" TargetName="TopAccent" Value="{StaticResource HorizontalSliderThumbTopAccentHover}"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="{StaticResource HorizontalSliderThumbBottomAccentHover}"/>
                        </Trigger>
                        <Trigger Property="Foreground" Value="Orange">
                            <Setter Property="Fill" TargetName="TopAccent" Value="{StaticResource HorizontalSliderThumbTopAccentHover}"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="{StaticResource HorizontalSliderThumbBottomAccentHover}"/>
                        </Trigger>
                        <Trigger Property="IsDragging" Value="true">
                            <Setter Property="Fill" TargetName="TopAccent" Value="{StaticResource HorizontalSliderThumbTopAccentPressed}"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="{StaticResource HorizontalSliderThumbBottomAccentPressed}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Fill" TargetName="Background" Value="#FFF5F4EA"/>
                            <Setter Property="Stroke" TargetName="OuterBorder" Value="#FFD6D4C6"/>
                            <Setter Property="Fill" TargetName="TopAccent" Value="#FFD2D0C6"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="#FFBCBAAE"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <SolidColorBrush x:Key="SliderThumbBackgroundInverted" Color="#F3F3EF"/>
    <Geometry x:Key="SliderPointedThumbOuterBorderGeometry">M 5,-8 A 1.5 1.5 0 0 0 3.5,-9.5 L -3.5,-9.5 A 1.5 1.5 0 0 0 -5,-8 L -5,5.5 L 0,10.5 L 5,5.5 Z</Geometry>
    <LinearGradientBrush x:Key="HorizontalSliderThumbTopAccentInverted" EndPoint="1,1" StartPoint="0,0">
        <GradientStop Color="#46CA44" Offset="1"/>
        <GradientStop Color="#1B9B1A" Offset="0"/>
    </LinearGradientBrush>
    <Geometry x:Key="SliderPointedThumbTopAccentGeometry">M 4.5,-6 L 4.5,-9 L -4.5,-9 L -4.5,-6 Z</Geometry>
    <LinearGradientBrush x:Key="HorizontalSliderThumbBottomAccentInverted" EndPoint="1,1" StartPoint="0,0">
        <GradientStop Color="#70D66F" Offset="1"/>
        <GradientStop Color="#46CA44" Offset=".2"/>
    </LinearGradientBrush>
    <Geometry x:Key="SliderPointedThumbBottomAccentGeometry">M 4.5,4 L 0,8.5 L -4.5,4 L -4.5,5 L 0,10 L 4.5,5 Z</Geometry>
    <LinearGradientBrush x:Key="HorizontalSliderThumbShadeGradientInverted" EndPoint="1,0" StartPoint="0,0">
        <GradientStop Color="#40FFFFFF" Offset="1"/>
        <GradientStop Color="#00FFFFFF" Offset=".7"/>
        <GradientStop Color="#00000000" Offset=".3"/>
        <GradientStop Color="#40000000" Offset="0"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="HorizontalSliderThumbBorderInverted" EndPoint="1,1" StartPoint="0,0">
        <GradientStop Color="#FFBECBD3" Offset="1"/>
        <GradientStop Color="#FF72838D" Offset="0"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="HorizontalSliderThumbTopAccentHoverInverted" EndPoint="1,1" StartPoint="0,0">
        <GradientStop Color="#FAC055" Offset="1"/>
        <GradientStop Color="#C7902A" Offset="0"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="HorizontalSliderThumbBottomAccentHoverInverted" EndPoint="1,1" StartPoint="0,0">
        <GradientStop Color="#FBCE7C" Offset="1"/>
        <GradientStop Color="#F7B335" Offset=".2"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="HorizontalSliderThumbTopAccentPressedInverted" EndPoint="1,1" StartPoint="0,0">
        <GradientStop Color="#46A638" Offset="1"/>
        <GradientStop Color="#1B770E" Offset="0"/>
    </LinearGradientBrush>
    <Style x:Key="HorizontalSliderUpThumbStyle" TargetType="{x:Type Thumb}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Height" Value="22"/>
        <Setter Property="Width" Value="11"/>
        <Setter Property="Foreground" Value="Green"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Canvas SnapsToDevicePixels="true">
                        <Canvas.RenderTransform>
                            <TransformGroup>
                                <TransformGroup.Children>
                                    <TransformCollection>
                                        <RotateTransform Angle="180"/>
                                        <TranslateTransform X="5.5" Y="11"/>
                                    </TransformCollection>
                                </TransformGroup.Children>
                            </TransformGroup>
                        </Canvas.RenderTransform>
                        <Path x:Name="Background" Fill="{StaticResource SliderThumbBackgroundInverted}" Data="{StaticResource SliderPointedThumbOuterBorderGeometry}"/>
                        <Path x:Name="TopAccent" Fill="{StaticResource HorizontalSliderThumbTopAccentInverted}" StrokeThickness="1" Data="{StaticResource SliderPointedThumbTopAccentGeometry}"/>
                        <Path x:Name="BottomAccent" Fill="{StaticResource HorizontalSliderThumbBottomAccentInverted}" StrokeThickness="1" Data="{StaticResource SliderPointedThumbBottomAccentGeometry}"/>
                        <Path x:Name="OuterBorder" Fill="{StaticResource HorizontalSliderThumbShadeGradientInverted}" Stroke="{StaticResource HorizontalSliderThumbBorderInverted}" StrokeThickness="1" Data="{StaticResource SliderPointedThumbOuterBorderGeometry}"/>
                    </Canvas>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Fill" TargetName="TopAccent" Value="{StaticResource HorizontalSliderThumbTopAccentHoverInverted}"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="{StaticResource HorizontalSliderThumbBottomAccentHoverInverted}"/>
                        </Trigger>
                        <Trigger Property="Foreground" Value="Orange">
                            <Setter Property="Fill" TargetName="TopAccent" Value="{StaticResource HorizontalSliderThumbTopAccentHoverInverted}"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="{StaticResource HorizontalSliderThumbBottomAccentHoverInverted}"/>
                        </Trigger>
                        <Trigger Property="IsDragging" Value="true">
                            <Setter Property="Fill" TargetName="TopAccent" Value="{StaticResource HorizontalSliderThumbTopAccentPressedInverted}"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="{StaticResource HorizontalSliderThumbTopAccentPressedInverted}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Fill" TargetName="Background" Value="#FFF5F4EA"/>
                            <Setter Property="Stroke" TargetName="OuterBorder" Value="#FFD6D4C6"/>
                            <Setter Property="Fill" TargetName="TopAccent" Value="#BBB9AD"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="Transparent"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="HorizontalSliderDownThumbStyle" TargetType="{x:Type Thumb}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Height" Value="22"/>
        <Setter Property="Width" Value="11"/>
        <Setter Property="Foreground" Value="Green"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Canvas SnapsToDevicePixels="true">
                        <Canvas.RenderTransform>
                            <TranslateTransform X="5.5" Y="11"/>
                        </Canvas.RenderTransform>
                        <Path x:Name="Background" Fill="{StaticResource SliderThumbBackground}" Data="{StaticResource SliderPointedThumbOuterBorderGeometry}"/>
                        <Path x:Name="TopAccent" Fill="{StaticResource HorizontalSliderThumbTopAccent}" StrokeThickness="1" Data="{StaticResource SliderPointedThumbTopAccentGeometry}"/>
                        <Path x:Name="BottomAccent" Fill="{StaticResource HorizontalSliderThumbBottomAccent}" StrokeThickness="1" Data="{StaticResource SliderPointedThumbBottomAccentGeometry}"/>
                        <Path x:Name="OuterBorder" Fill="{StaticResource HorizontalSliderThumbShadeGradient}" Stroke="{StaticResource HorizontalSliderThumbBorder}" StrokeThickness="1" Data="{StaticResource SliderPointedThumbOuterBorderGeometry}"/>
                    </Canvas>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Fill" TargetName="TopAccent" Value="{StaticResource HorizontalSliderThumbTopAccentHover}"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="{StaticResource HorizontalSliderThumbBottomAccentHover}"/>
                        </Trigger>
                        <Trigger Property="Foreground" Value="Orange">
                            <Setter Property="Fill" TargetName="TopAccent" Value="{StaticResource HorizontalSliderThumbTopAccentHover}"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="{StaticResource HorizontalSliderThumbBottomAccentHover}"/>
                        </Trigger>
                        <Trigger Property="IsDragging" Value="true">
                            <Setter Property="Fill" TargetName="TopAccent" Value="{StaticResource HorizontalSliderThumbTopAccentPressed}"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="{StaticResource HorizontalSliderThumbBottomAccentPressed}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Fill" TargetName="Background" Value="#FFF5F4EA"/>
                            <Setter Property="Stroke" TargetName="OuterBorder" Value="#FFD6D4C6"/>
                            <Setter Property="Fill" TargetName="TopAccent" Value="#FFD2D0C6"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="Transparent"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <SolidColorBrush x:Key="VerticalSliderTrackNormalBackground" Color="#FFF0EDE0"/>
    <LinearGradientBrush x:Key="VerticalSliderTrackNormalBorder" EndPoint="1,0" StartPoint="0,0">
        <GradientStop Color="#FFAEB1AF" Offset="0.1"/>
        <GradientStop Color="White" Offset=".9"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="VerticalSliderThumbTopAccent" EndPoint="0,1" StartPoint="1,0">
        <GradientStop Color="#70D66F" Offset="0"/>
        <GradientStop Color="#46CA44" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="VerticalSliderThumbBottomAccent" EndPoint="0,1" StartPoint="1,0">
        <GradientStop Color="#46CA44" Offset="0"/>
        <GradientStop Color="#1B9B1A" Offset=".8"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="VerticalSliderThumbShadeGradient" EndPoint="0,0" StartPoint="1,0">
        <GradientStop Color="#40FFFFFF" Offset="0"/>
        <GradientStop Color="#00FFFFFF" Offset=".3"/>
        <GradientStop Color="#00000000" Offset=".7"/>
        <GradientStop Color="#40000000" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="VerticalSliderThumbBorder" EndPoint="0,.5" StartPoint="1,0">
        <GradientStop Color="#FFBECBD3" Offset="0"/>
        <GradientStop Color="#FF72838D" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="VerticalSliderThumbTopAccentHover" EndPoint="0,1" StartPoint="1,0">
        <GradientStop Color="#FBCE7C" Offset="0"/>
        <GradientStop Color="#F7B335" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="VerticalSliderThumbBottomAccentHover" EndPoint="0,1" StartPoint="1,0">
        <GradientStop Color="#FAC055" Offset="0"/>
        <GradientStop Color="#C7902A" Offset=".8"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="VerticalSliderThumbTopAccentPressed" EndPoint="0,1" StartPoint="1,0">
        <GradientStop Color="#70BA66" Offset="0"/>
        <GradientStop Color="#229412" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="VerticalSliderThumbBottomAccentPressed" EndPoint="0,1" StartPoint="1,0">
        <GradientStop Color="#46A638" Offset="0"/>
        <GradientStop Color="#1B770E" Offset=".8"/>
    </LinearGradientBrush>
    <Style x:Key="VerticalSliderThumbStyle" TargetType="{x:Type Thumb}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Width" Value="22"/>
        <Setter Property="Height" Value="11"/>
        <Setter Property="Foreground" Value="Green"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Canvas SnapsToDevicePixels="true">
                        <Canvas.RenderTransform>
                            <TransformGroup>
                                <TransformGroup.Children>
                                    <TransformCollection>
                                        <RotateTransform Angle="-90"/>
                                        <TranslateTransform X="11" Y="5.5"/>
                                    </TransformCollection>
                                </TransformGroup.Children>
                            </TransformGroup>
                        </Canvas.RenderTransform>
                        <Rectangle Width="8.75" Height="8.792" Canvas.Left="-4.25" Canvas.Top="-10.209" Fill="Transparent" />
                        <Path Width="8.75" Height="8.792" Fill="#FFA5452A" Stretch="Fill" Stroke="#FFA5452A" Data="M9.5,-1.625 L5.4166667,-9.4157592 1.75,-1.625 z" Canvas.Left="-4.25" Canvas.Top="-10.209"/>
                        <Path HorizontalAlignment="Stretch" x:Name="OuterBorder" VerticalAlignment="Stretch" Width="9.5" Height="9.625" Fill="{StaticResource VerticalSliderThumbShadeGradient}" Stroke="{x:Null}" StrokeThickness="1" Panel.ZIndex="-1" Data="M4.5312501,6.9388954E-18 A1.5,1.5,0,0,0,4.46875,0.15624998 L4.5833334,0.083666627 A1.5,1.5,0,0,0,4.4375001,0.15625 L6.9009491E-05,9.5006667 A1.5,1.5,0,0,0,0.00024812574,9.5423334 L9.499915,9.6250697 A1.5,1.5,0,0,0,9.125,8.78125 z" Canvas.Left="-4.625" Canvas.Top="-10.75"/>
                      
                    </Canvas>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true"/>
                        <Trigger Property="Foreground" Value="Orange"/>
                        <Trigger Property="IsDragging" Value="true"/>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Stroke" TargetName="OuterBorder" Value="#FFD6D4C6"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <LinearGradientBrush x:Key="VerticalSliderThumbTopAccentInverted" EndPoint="0,1" StartPoint="1,0">
        <GradientStop Color="#46CA44" Offset="1"/>
        <GradientStop Color="#1B9B1A" Offset="0"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="VerticalSliderThumbBottomAccentInverted" EndPoint="0,1" StartPoint="1,0">
        <GradientStop Color="#70D66F" Offset="1"/>
        <GradientStop Color="#46CA44" Offset=".2"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="VerticalSliderThumbShadeGradientInverted" EndPoint="0,0" StartPoint="1,0">
        <GradientStop Color="#40FFFFFF" Offset="1"/>
        <GradientStop Color="#00FFFFFF" Offset=".7"/>
        <GradientStop Color="#00000000" Offset=".3"/>
        <GradientStop Color="#40000000" Offset="0"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="VerticalSliderThumbBorderInverted" EndPoint="0,1" StartPoint="1,0">
        <GradientStop Color="#FFBECBD3" Offset="1"/>
        <GradientStop Color="#FF72838D" Offset="0"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="VerticalSliderThumbTopAccentHoverInverted" EndPoint="0,1" StartPoint="1,0">
        <GradientStop Color="#FAC055" Offset="1"/>
        <GradientStop Color="#C7902A" Offset="0"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="VerticalSliderThumbBottomAccentHoverInverted" EndPoint="0,1" StartPoint="1,0">
        <GradientStop Color="#FBCE7C" Offset="1"/>
        <GradientStop Color="#F7B335" Offset=".2"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="VerticalSliderThumbTopAccentPressedInverted" EndPoint="0,1" StartPoint="1,0">
        <GradientStop Color="#46A638" Offset="1"/>
        <GradientStop Color="#1B770E" Offset="0"/>
    </LinearGradientBrush>
    <Style x:Key="VerticalSliderLeftThumbStyle" TargetType="{x:Type Thumb}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Width" Value="22"/>
        <Setter Property="Height" Value="11"/>
        <Setter Property="Foreground" Value="Green"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Canvas SnapsToDevicePixels="true">
                        <Canvas.RenderTransform>
                            <TransformGroup>
                                <TransformGroup.Children>
                                    <TransformCollection>
                                        <RotateTransform Angle="90"/>
                                        <TranslateTransform X="11" Y="5.5"/>
                                    </TransformCollection>
                                </TransformGroup.Children>
                            </TransformGroup>
                        </Canvas.RenderTransform>
                        <Path x:Name="Background" Fill="{StaticResource SliderThumbBackground}" Data="{StaticResource SliderPointedThumbOuterBorderGeometry}"/>
                        <Path x:Name="TopAccent" Fill="{StaticResource VerticalSliderThumbTopAccentInverted}" StrokeThickness="1" Data="{StaticResource SliderPointedThumbTopAccentGeometry}"/>
                        <Path x:Name="BottomAccent" Fill="{StaticResource VerticalSliderThumbBottomAccentInverted}" StrokeThickness="1" Data="{StaticResource SliderPointedThumbBottomAccentGeometry}"/>
                        <Path x:Name="OuterBorder" Fill="{StaticResource VerticalSliderThumbShadeGradientInverted}" Stroke="{StaticResource VerticalSliderThumbBorderInverted}" StrokeThickness="1" Data="{StaticResource SliderPointedThumbOuterBorderGeometry}"/>
                        
                    </Canvas>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Fill" TargetName="TopAccent" Value="{StaticResource VerticalSliderThumbTopAccentHoverInverted}"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="{StaticResource VerticalSliderThumbBottomAccentHoverInverted}"/>
                        </Trigger>
                        <Trigger Property="Foreground" Value="Orange">
                            <Setter Property="Fill" TargetName="TopAccent" Value="{StaticResource VerticalSliderThumbTopAccentHoverInverted}"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="{StaticResource VerticalSliderThumbBottomAccentHoverInverted}"/>
                        </Trigger>
                        <Trigger Property="IsDragging" Value="true">
                            <Setter Property="Fill" TargetName="TopAccent" Value="{StaticResource VerticalSliderThumbTopAccentPressedInverted}"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="{StaticResource VerticalSliderThumbTopAccentPressedInverted}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Fill" TargetName="Background" Value="#FFF5F4EA"/>
                            <Setter Property="Stroke" TargetName="OuterBorder" Value="#FFD6D4C6"/>
                            <Setter Property="Fill" TargetName="TopAccent" Value="#BBB9AD"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="Transparent"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="VerticalSliderRightThumbStyle" TargetType="{x:Type Thumb}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Width" Value="22"/>
        <Setter Property="Height" Value="11"/>
        <Setter Property="Foreground" Value="Green"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Canvas SnapsToDevicePixels="true">
                        <Canvas.RenderTransform>
                            <TransformGroup>
                                <TransformGroup.Children>
                                    <TransformCollection>
                                        <RotateTransform Angle="-90"/>
                                        <TranslateTransform X="11" Y="5.5"/>
                                    </TransformCollection>
                                </TransformGroup.Children>
                            </TransformGroup>
                        </Canvas.RenderTransform>
                        <Path x:Name="Background" Fill="{StaticResource SliderThumbBackgroundInverted}" Data="{StaticResource SliderPointedThumbOuterBorderGeometry}"/>
                        <Path x:Name="TopAccent" Fill="{StaticResource VerticalSliderThumbTopAccent}" StrokeThickness="1" Data="{StaticResource SliderPointedThumbTopAccentGeometry}"/>
                        <Path x:Name="BottomAccent" Fill="{StaticResource VerticalSliderThumbBottomAccent}" StrokeThickness="1" Data="{StaticResource SliderPointedThumbBottomAccentGeometry}"/>
                        <Path x:Name="OuterBorder" Fill="{StaticResource VerticalSliderThumbShadeGradient}" Stroke="{StaticResource VerticalSliderThumbBorder}" StrokeThickness="1" Data="{StaticResource SliderPointedThumbOuterBorderGeometry}"/>
                       
                    </Canvas>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Fill" TargetName="TopAccent" Value="{StaticResource VerticalSliderThumbTopAccentHover}"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="{StaticResource VerticalSliderThumbBottomAccentHover}"/>
                        </Trigger>
                        <Trigger Property="Foreground" Value="Orange">
                            <Setter Property="Fill" TargetName="TopAccent" Value="{StaticResource VerticalSliderThumbTopAccentHover}"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="{StaticResource VerticalSliderThumbBottomAccentHover}"/>
                        </Trigger>
                        <Trigger Property="IsDragging" Value="true">
                            <Setter Property="Fill" TargetName="TopAccent" Value="{StaticResource VerticalSliderThumbTopAccentPressed}"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="{StaticResource VerticalSliderThumbBottomAccentPressed}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Fill" TargetName="Background" Value="#FFF5F4EA"/>
                            <Setter Property="Stroke" TargetName="OuterBorder" Value="#FFD6D4C6"/>
                            <Setter Property="Fill" TargetName="TopAccent" Value="#FFD2D0C6"/>
                            <Setter Property="Fill" TargetName="BottomAccent" Value="Transparent"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="SliderStyle" TargetType="{x:Type Slider}">
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Foreground" Value="#FFA1A192"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Slider}">
                    <Border SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <TickBar Visibility="Collapsed" x:Name="TopTick" Height="4" Grid.Row="0" Fill="{TemplateBinding Foreground}" Placement="Top"/>
                            <TickBar Visibility="Collapsed" x:Name="BottomTick" Height="4" Grid.Row="2" Fill="{TemplateBinding Foreground}" Placement="Bottom"/>
                            <Border Margin="5,0" VerticalAlignment="Center" Height="4.0" Grid.Row="1" Background="{StaticResource HorizontalSliderTrackNormalBackground}" BorderBrush="{StaticResource HorizontalSliderTrackNormalBorder}" BorderThickness="1" CornerRadius="1">
                                <Canvas Margin="-6,-1">
                                    <Rectangle Visibility="Hidden" x:Name="PART_SelectionRange" Height="4.0" Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" Stroke="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" StrokeThickness="1.0"/>
                                </Canvas>
                            </Border>
                            <Track x:Name="PART_Track" Grid.Row="1">
                                <Track.Thumb>
                                    <Thumb x:Name="Thumb" Style="{StaticResource HorizontalSliderThumbStyle}"/>
                                </Track.Thumb>
                                <Track.IncreaseRepeatButton>
                                    <RepeatButton Style="{StaticResource SliderRepeatButtonStyle}" Command="{x:Static Slider.IncreaseLarge}"/>
                                </Track.IncreaseRepeatButton>
                                <Track.DecreaseRepeatButton>
                                    <RepeatButton Style="{StaticResource SliderRepeatButtonStyle}" Command="{x:Static Slider.DecreaseLarge}"/>
                                </Track.DecreaseRepeatButton>
                            </Track>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="TickPlacement" Value="TopLeft">
                            <Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
                            <Setter Property="Style" TargetName="Thumb" Value="{StaticResource HorizontalSliderUpThumbStyle}"/>
                        </Trigger>
                        <Trigger Property="TickPlacement" Value="BottomRight">
                            <Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
                            <Setter Property="Style" TargetName="Thumb" Value="{StaticResource HorizontalSliderDownThumbStyle}"/>
                        </Trigger>
                        <Trigger Property="TickPlacement" Value="Both">
                            <Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
                            <Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsSelectionRangeEnabled" Value="true">
                            <Setter Property="Visibility" TargetName="PART_SelectionRange" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="true">
                            <Setter Property="Foreground" TargetName="Thumb" Value="Orange"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Vertical">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Slider}">
                            <Border SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Width="9">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition MinWidth="{TemplateBinding MinWidth}" Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <TickBar Visibility="Collapsed" x:Name="LeftTick" Width="4" Grid.Column="0" Fill="{TemplateBinding Foreground}" Placement="Left"/>
                                    <TickBar Visibility="Collapsed" x:Name="RightTick" Width="4" Grid.Column="2" Fill="{TemplateBinding Foreground}" Placement="Right"/>
                                    <Border HorizontalAlignment="Right" Margin="0,0,10,0" Width="3" Grid.Column="1" Background="{StaticResource VerticalSliderTrackNormalBackground}" BorderBrush="{StaticResource VerticalSliderTrackNormalBorder}" BorderThickness="1" CornerRadius="1" RenderTransformOrigin="0.5,0.5" Grid.ColumnSpan="1">
                                        <Border.RenderTransform>
                                            <TransformGroup>
                    
                            <ScaleTransform ScaleX="1" ScaleY="1"/>
                                                <SkewTransform AngleX="0" AngleY="0"/>
                                                <RotateTransform Angle="0"/>
                                                <TranslateTransform X="0" Y="0"/>
                                            </TransformGroup>
                                        </Border.RenderTransform>
                                        <Canvas Margin="-1,-6">
                                            <Rectangle Visibility="Hidden" x:Name="PART_SelectionRange" Width="4.0" Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" Stroke="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" StrokeThickness="1.0"/>
                                        </Canvas>
                                    </Border>
                                    <Track x:Name="PART_Track" Grid.Column="1">
                                        <Track.Thumb>
                                            <Thumb x:Name="Thumb" Style="{StaticResource VerticalSliderThumbStyle}"/>
                                        </Track.Thumb>
                                        <Track.IncreaseRepeatButton>
                                            <RepeatButton Style="{StaticResource SliderRepeatButtonStyle}" Command="{x:Static Slider.IncreaseLarge}"/>
                                        </Track.IncreaseRepeatButton>
                                        <Track.DecreaseRepeatButton>
                                            <RepeatButton Style="{StaticResource SliderRepeatButtonStyle}" Command="{x:Static Slider.DecreaseLarge}"/>
                                        </Track.DecreaseRepeatButton>
                                    </Track>
                                </Grid>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="TickPlacement" Value="TopLeft">
                                    <Setter Property="Visibility" TargetName="LeftTick" Value="Visible"/>
                                    <Setter Property="Style" TargetName="Thumb" Value="{StaticResource VerticalSliderLeftThumbStyle}"/>
                                </Trigger>
                                <Trigger Property="TickPlacement" Value="BottomRight">
                                    <Setter Property="Visibility" TargetName="RightTick" Value="Visible"/>
                                    <Setter Property="Style" TargetName="Thumb" Value="{StaticResource VerticalSliderRightThumbStyle}"/>
                                </Trigger>
                                <Trigger Property="TickPlacement" Value="Both">
                                    <Setter Property="Visibility" TargetName="LeftTick" Value="Visible"/>
                                    <Setter Property="Visibility" TargetName="RightTick" Value="Visible"/>
                                </Trigger>
                                <Trigger Property="IsSelectionRangeEnabled" Value="true">
                                    <Setter Property="Visibility" TargetName="PART_SelectionRange" Value="Visible"/>
                                </Trigger>
                                <Trigger Property="IsKeyboardFocused" Value="true">
                                    <Setter Property="Foreground" TargetName="Thumb" Value="Orange"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

KenJohnson
Software Developer (Senior)
United States United States
Written software for what seems like forever. I'm currenly infatuated with WPF. Hopefully my affections are returned.

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 26 Dec 2010
Article Copyright 2010 by KenJohnson
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid