Merge branch 'master' into pr/84

This commit is contained in:
NaBian committed 2019-06-18 20:19:22 +08:00
commit c757ebac53
166 files changed
+4558 -1259

No files matched your search

@@ -97,6 +97,8 @@
public static readonly string GridDemoCtl = nameof(GridDemoCtl);
public static readonly string PoptipDemoCtl = nameof(PoptipDemoCtl);
public static readonly string RangeSliderDemoCtl = nameof(RangeSliderDemoCtl);
public static readonly string ButtonDemoCtl = nameof(ButtonDemoCtl);
@@ -51,7 +51,8 @@ var controlList = new List<string>
"DialogDemoCtl",
"SideMenuDemoCtl",
"GridDemoCtl",
"PoptipDemoCtl"
"PoptipDemoCtl",
"RangeSliderDemoCtl"
};
var styleList = new List<string>
{
@@ -25,7 +25,6 @@
<SubType>Code</SubType>
<DependentUpon>MainWindow.xaml</DependentUpon>
</Compile>
<!-- <Compile Include="$(MSBuildThisFileDirectory)Properties\Langs\Lang.Designer.cs" /> -->
<Compile Include="$(MSBuildThisFileDirectory)Service\DataService.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\String2BrushConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\StringRepeatConverter.cs" />
@@ -48,6 +47,12 @@
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\AnimationPathDemoCtl.xaml.cs">
<DependentUpon>AnimationPathDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\RangeSliderDemoCtl.xaml.cs">
<DependentUpon>RangeSliderDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\RelativePanelDemoCtl.xaml.cs">
<DependentUpon>RelativePanelDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\BadgeDemoCtl.xaml.cs">
<DependentUpon>BadgeDemoCtl.xaml</DependentUpon>
</Compile>
@@ -397,6 +402,14 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\RelativePanelDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\RangeSliderDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\BadgeDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -13,5 +13,5 @@ using System.Windows;
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly: AssemblyVersion("1.5.5")]
[assembly: AssemblyVersion("2.0.0")]
#endif
@@ -609,4 +609,16 @@
<data name="Project" xml:space="preserve">
<value>Project</value>
</data>
<data name="RangeSlider" xml:space="preserve">
<value>RangeSlider</value>
</data>
<data name="RelativePanel" xml:space="preserve">
<value>RelativePanel</value>
</data>
<data name="On" xml:space="preserve">
<value>On</value>
</data>
<data name="Off" xml:space="preserve">
<value>Off</value>
</data>
</root>
@@ -609,4 +609,16 @@
<data name="Project" xml:space="preserve">
<value>项目</value>
</data>
<data name="RangeSlider" xml:space="preserve">
<value>范围滑块</value>
</data>
<data name="RelativePanel" xml:space="preserve">
<value>相对布局</value>
</data>
<data name="On" xml:space="preserve">
<value>开</value>
</data>
<data name="Off" xml:space="preserve">
<value>关</value>
</data>
</root>
Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

@@ -19,7 +19,7 @@ namespace HandyControlDemo.Service
for (var i = 1; i <= 20; i++)
{
var dataList = new List<DemoDataModel>();
for (int j = 0; j < 3; j++)
for (var j = 0; j < 3; j++)
{
dataList.Add(new DemoDataModel
{
@@ -135,6 +135,12 @@ namespace HandyControlDemo.Service
DisplayName = "AutumnBox",
AvatarUri = "https://www.atmb.top/images/leaves.png",
Link = "https://github.com/zsh2401/AutumnBox"
},
new AvatarModel
{
DisplayName = "PandaX Studio",
AvatarUri = "https://raw.githubusercontent.com/aboutlong/pandaxstudio/master/pandax/pandax/source/image/logo.png",
Link = "https://github.com/aboutlong/pandaxstudio"
}
};
}
@@ -0,0 +1,22 @@
<UserControl x:Class="HandyControlDemo.UserControl.RangeSliderDemoCtl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
Background="{DynamicResource RegionBrush}">
<hc:TransitioningContentControl>
<StackPanel Margin="32" Orientation="Horizontal">
<StackPanel>
<hc:RangeSlider Width="400" IsSnapToTickEnabled="True" ValueStart="2" ValueEnd="8"/>
<hc:RangeSlider Width="400" IsSnapToTickEnabled="True" ValueEnd="3" Margin="0,32,0,0" IsEnabled="False"/>
<hc:RangeSlider Width="400" hc:TipElement.Visibility="Visible" IsSnapToTickEnabled="True" Maximum="100" ValueEnd="60" TickFrequency="10" TickPlacement="BottomRight" Margin="0,32,0,0"/>
<hc:RangeSlider Width="400" hc:TipElement.Visibility="Visible" hc:TipElement.Placement="BottomRight" IsSnapToTickEnabled="True" ValueEnd="5" TickPlacement="Both" Margin="0,32,0,0"/>
</StackPanel>
<StackPanel Margin="32,0,0,0" Orientation="Horizontal">
<hc:RangeSlider Height="400" IsSnapToTickEnabled="True" ValueEnd="8" Orientation="Vertical"/>
<hc:RangeSlider Height="400" IsSnapToTickEnabled="True" ValueEnd="3" Margin="32,0,0,0" IsEnabled="False" Orientation="Vertical"/>
<hc:RangeSlider Height="400" hc:TipElement.Visibility="Visible" IsSnapToTickEnabled="True" Maximum="100" ValueEnd="60" TickFrequency="10" TickPlacement="BottomRight" Margin="32,0,0,0" Orientation="Vertical"/>
<hc:RangeSlider Height="400" hc:TipElement.Visibility="Visible" hc:TipElement.Placement="BottomRight" IsSnapToTickEnabled="True" ValueEnd="5" TickPlacement="Both" Margin="32,0" Orientation="Vertical"/>
</StackPanel>
</StackPanel>
</hc:TransitioningContentControl>
</UserControl>
@@ -0,0 +1,10 @@
namespace HandyControlDemo.UserControl
{
public partial class RangeSliderDemoCtl
{
public RangeSliderDemoCtl()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,6 @@
<UserControl x:Class="HandyControlDemo.UserControl.RelativePanelDemoCtl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl">
<userControl:UnderConstruction/>
</UserControl>
@@ -0,0 +1,10 @@
namespace HandyControlDemo.UserControl
{
public partial class RelativePanelDemoCtl
{
public RelativePanelDemoCtl()
{
InitializeComponent();
}
}
}
@@ -335,7 +335,7 @@
<Image Source="../../Resources/Img/LeftMainContent/LinearCarousel_16x.png"/>
</hc:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.ProgressBarDemoCtl}" Content="{x:Static langs:Lang.ProgressBar}">
<ListBoxItem Tag="{x:Static data:MessageToken.ProgressBarDemoCtl}" Content="{x:Static langs:Lang.ProgressBar}">
<hc:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/ProgressBar_16x.png"/>
</hc:EdgeElement.LeftContent>
@@ -380,6 +380,11 @@
<Image Source="../../Resources/Img/LeftMainContent/HoverMenu_16x.png"/>
</hc:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.RangeSliderDemoCtl}" Content="{x:Static langs:Lang.RangeSlider}">
<hc:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/brackets_Square_16xLG.png"/>
</hc:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.TimeBarDemoCtl}" Content="{x:Static langs:Lang.TimeBar}">
<hc:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/Timeline_16x.png"/>
@@ -410,7 +415,7 @@
<Image Source="../../Resources/Img/LeftMainContent/ScrollBox_16x.png"/>
</hc:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.DialogDemoCtl}" Content="{x:Static langs:Lang.Dialog}">
<ListBoxItem Tag="{x:Static data:MessageToken.DialogDemoCtl}" Content="{x:Static langs:Lang.Dialog}">
<hc:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/Dialog_16x.png"/>
</hc:EdgeElement.LeftContent>
@@ -1,9 +1,5 @@
namespace HandyControlDemo.UserControl
namespace HandyControlDemo.UserControl
{
/// <summary>
/// ButtonDemoCtl.xaml 的交互逻辑
/// </summary>
public partial class ButtonDemoCtl
{
public ButtonDemoCtl()
@@ -13,7 +13,7 @@
<ComboBox ItemsSource="{Binding DataList}" SelectedIndex="0" Margin="0,16,0,0" IsEditable="True"/>
<ComboBox ItemsSource="{Binding DataList}" SelectedIndex="0" hc:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr1}" Style="{StaticResource ComboBoxExtend}" Margin="0,32,0,0" Text="{x:Static langs:Lang.ContentDemoStr}"/>
<ComboBox ItemsSource="{Binding DataList}" hc:InfoElement.Placeholder="{x:Static langs:Lang.PlsEnterContent}" hc:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr2}" Style="{StaticResource ComboBoxExtend}" hc:InfoElement.Necessary="True" Margin="0,16,0,0"/>
<ComboBox ItemsSource="{Binding DataList}" hc:InfoElement.Placeholder="{x:Static langs:Lang.PlsEnterContent}" hc:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr2}" Style="{StaticResource ComboBoxExtend}" hc:InfoElement.Necessary="True" hc:InfoElement.Symbol="*" Margin="0,16,0,0"/>
<ComboBox ItemsSource="{Binding DataList}" IsEditable="True" SelectedIndex="0" hc:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr1}" Style="{StaticResource ComboBoxExtend}" Margin="0,16,0,0" Text="{x:Static langs:Lang.ContentDemoStr}"/>
<ComboBox ItemsSource="{Binding DataList}" IsEditable="True" hc:InfoElement.Placeholder="{x:Static langs:Lang.PlsEnterContent}" hc:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr2}" Style="{StaticResource ComboBoxExtend}" hc:InfoElement.Necessary="True" Margin="0,16,0,0"/>
@@ -104,6 +104,29 @@
<ToggleButton IsEnabled="False" IsChecked="True" HorizontalAlignment="Center" Margin="5,9" Style="{StaticResource ToggleButtonSwitch}"/>
<TextBlock Style="{StaticResource TextBlockDefault}" Text="ToggleButtonSwitch"/>
</StackPanel>
<StackPanel>
<ToggleButton BorderThickness="0" IsChecked="True" Margin="5" HorizontalAlignment="Center" Style="{StaticResource ToggleButtonFlip}">
<hc:StatusSwitchElement.CheckedElement>
<Border Background="{DynamicResource PrimaryBrush}">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{x:Static langs:Lang.Off}" Foreground="{DynamicResource TextIconBrush}"/>
</Border>
</hc:StatusSwitchElement.CheckedElement>
<Border Background="{DynamicResource DangerBrush}">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{x:Static langs:Lang.On}" Foreground="{DynamicResource TextIconBrush}"/>
</Border>
</ToggleButton>
<ToggleButton BorderThickness="0" IsEnabled="False" IsChecked="True" Margin="5" HorizontalAlignment="Center" Style="{StaticResource ToggleButtonFlip}">
<hc:StatusSwitchElement.CheckedElement>
<Border Background="{DynamicResource PrimaryBrush}">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{x:Static langs:Lang.Off}" Foreground="{DynamicResource TextIconBrush}"/>
</Border>
</hc:StatusSwitchElement.CheckedElement>
<Border Background="{DynamicResource DangerBrush}">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{x:Static langs:Lang.On}" Foreground="{DynamicResource TextIconBrush}"/>
</Border>
</ToggleButton>
<TextBlock Style="{StaticResource TextBlockDefault}" Text="ToggleButtonFlip"/>
</StackPanel>
</WrapPanel>
</StackPanel>
</hc:ScrollViewer>
@@ -1,23 +1,24 @@
<hc:Window x:Class="HandyControlDemo.Window.AboutWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
Title="{x:Static langs:Lang.About}"
ShowTitle="True"
BorderThickness="1"
BorderBrush="#262e2f"
Style="{StaticResource WindowWin10}"
ResizeMode="NoResize"
ShowInTaskbar="False"
WindowStartupLocation="CenterOwner"
Width="340"
Height="220">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
Title="{x:Static langs:Lang.About}"
ShowTitle="True"
BorderThickness="1"
BorderBrush="#262e2f"
Style="{StaticResource WindowWin10}"
ResizeMode="NoResize"
ShowInTaskbar="False"
WindowStartupLocation="CenterOwner"
Width="340"
Height="220">
<hc:SimplePanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,30,0,0">
<Path Data="{StaticResource LogoGeometry}" Width="40" Height="40" Fill="#f06632" VerticalAlignment="Top" Margin="0,16,0,0"/>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,64,0,0">
<TextBlock Text="HandyControl" FontSize="30" Foreground="{StaticResource PrimaryBrush}" VerticalAlignment="Top" HorizontalAlignment="Center"/>
<TextBlock Text="{Binding Version}" HorizontalAlignment="Center" Margin="0,10,0,0" Foreground="{StaticResource PrimaryBrush}"/>
</StackPanel>
@@ -246,7 +246,7 @@ namespace HandyControl.Controls
{
if (show)
{
for (int i = 0; i < itemsCount; i++)
for (var i = 0; i < itemsCount; i++)
{
var row = (DataGridRow)generator.ContainerFromIndex(i);
if (row != null)
@@ -257,7 +257,7 @@ namespace HandyControl.Controls
}
else
{
for (int i = 0; i < itemsCount; i++)
for (var i = 0; i < itemsCount; i++)
{
var row = (DataGridRow)generator.ContainerFromIndex(i);
if (row != null)
@@ -3,13 +3,13 @@ using HandyControl.Data;
namespace HandyControl.Controls
{
public class PasswordBoxMonitor
public class PasswordBoxAttach
{
/// <summary>
/// 密码长度
/// </summary>
public static readonly DependencyProperty PasswordLengthProperty = DependencyProperty.RegisterAttached(
"PasswordLength", typeof(int), typeof(PasswordBoxMonitor), new PropertyMetadata(ValueBoxes.Int0Box));
"PasswordLength", typeof(int), typeof(PasswordBoxAttach), new PropertyMetadata(ValueBoxes.Int0Box));
public static void SetPasswordLength(DependencyObject element, int value) => element.SetValue(PasswordLengthProperty, value);
@@ -19,7 +19,7 @@ namespace HandyControl.Controls
/// 是否监测
/// </summary>
public static readonly DependencyProperty IsMonitoringProperty = DependencyProperty.RegisterAttached(
"IsMonitoring", typeof(bool), typeof(PasswordBoxMonitor), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.Inherits, OnIsMonitoringChanged));
"IsMonitoring", typeof(bool), typeof(PasswordBoxAttach), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.Inherits, OnIsMonitoringChanged));
private static void OnIsMonitoringChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
@@ -333,7 +333,7 @@ namespace HandyControl.Controls
}
var list = new List<bool>();
for (int i = 0; i < 2; i++)
for (var i = 0; i < 2; i++)
{
list.Add(false);
}
@@ -135,7 +135,7 @@ namespace HandyControl.Controls
public static readonly DependencyProperty ItemContentHeightProperty = DependencyProperty.Register(
"ItemContentHeight", typeof(double), typeof(CoverView), new PropertyMetadata(ValueBoxes.Double300Box),
value => ValidateHelper.IsInRangeOfPosDouble(value, true));
ValidateHelper.IsInRangeOfPosDoubleIncludeZero);
public double ItemContentHeight
{
@@ -43,7 +43,7 @@ namespace HandyControl.Controls
}
internal static readonly DependencyProperty ManualHeightProperty = DependencyProperty.Register(
"ManualHeight", typeof(double), typeof(CoverViewContent), new PropertyMetadata(ValueBoxes.Double0Box), value => ValidateHelper.IsInRangeOfPosDouble(value, true));
"ManualHeight", typeof(double), typeof(CoverViewContent), new PropertyMetadata(ValueBoxes.Double0Box), ValidateHelper.IsInRangeOfPosDoubleIncludeZero);
internal double ManualHeight
{
@@ -53,7 +53,7 @@ namespace HandyControl.Controls
public static readonly DependencyProperty ContentHeightProperty = DependencyProperty.Register(
"ContentHeight", typeof(double), typeof(CoverViewContent), new PropertyMetadata(ValueBoxes.Double300Box),
value => ValidateHelper.IsInRangeOfPosDouble(value, true));
ValidateHelper.IsInRangeOfPosDoubleIncludeZero);
public double ContentHeight
{
@@ -14,11 +14,9 @@ namespace HandyControl.Controls
private double _maxChildDesiredHeight;
public static readonly DependencyProperty GutterProperty = DependencyProperty.Register(
"Gutter", typeof(double), typeof(Row), new PropertyMetadata(ValueBoxes.Double0Box, null, OnGutterCoerce), OnGutterValidate);
"Gutter", typeof(double), typeof(Row), new PropertyMetadata(ValueBoxes.Double0Box, null, OnGutterCoerce), ValidateHelper.IsInRangeOfPosDoubleIncludeZero);
private static object OnGutterCoerce(DependencyObject d, object basevalue) => OnGutterValidate(basevalue) ? basevalue : .0;
private static bool OnGutterValidate(object value) => ValidateHelper.IsInRangeOfPosDouble(value, true);
private static object OnGutterCoerce(DependencyObject d, object basevalue) => ValidateHelper.IsInRangeOfPosDoubleIncludeZero(basevalue) ? basevalue : .0;
public double Gutter
{
@@ -44,8 +42,6 @@ namespace HandyControl.Controls
}
}
var itemWidth = constraint.Width / ColLayout.ColMaxCellCount;
var childBounds = new Rect(-gutterHalf, -gutterHalf, 0, _maxChildDesiredHeight);
_layoutStatus = ColLayout.GetLayoutStatus(constraint.Width);
foreach (var child in InternalChildren.OfType<Col>())
@@ -55,15 +51,9 @@ namespace HandyControl.Controls
if (totalCellCount > ColLayout.ColMaxCellCount)
{
childBounds.X = -gutterHalf;
childBounds.Y += _maxChildDesiredHeight;
totalCellCount = cellCount;
totalRowCount++;
}
var childWidth = cellCount * itemWidth;
childBounds.Width = childWidth;
childBounds.X += childWidth + child.Offset * itemWidth;
}
return new Size(0, _maxChildDesiredHeight * totalRowCount - Gutter);
@@ -321,7 +321,7 @@ namespace HandyControl.Controls
try
{
for (int i = 0; i < count; i++)
for (var i = 0; i < count; i++)
{
guids[i] = (Guid)ExternDllHelper.PtrToStructure((IntPtr)((long)buffer + size * i), typeof(Guid));
}
@@ -153,7 +153,7 @@ namespace HandyControl.Controls
public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(
"Value", typeof(double), typeof(NumericUpDown),
new FrameworkPropertyMetadata(ValueBoxes.Double0Box, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
OnValueChanged, CoerceValue), ArithmeticHelper.IsValidDoubleValue);
OnValueChanged, CoerceValue), ValidateHelper.IsInRangeOfDouble);
private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
@@ -208,7 +208,7 @@ namespace HandyControl.Controls
/// 最大值
/// </summary>
public static readonly DependencyProperty MaximumProperty = DependencyProperty.Register(
"Maximum", typeof(double), typeof(NumericUpDown), new PropertyMetadata(double.MaxValue, OnMaximumChanged, CoerceMaximum), ArithmeticHelper.IsValidDoubleValue);
"Maximum", typeof(double), typeof(NumericUpDown), new PropertyMetadata(double.MaxValue, OnMaximumChanged, CoerceMaximum), ValidateHelper.IsInRangeOfDouble);
private static void OnMaximumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
@@ -236,7 +236,7 @@ namespace HandyControl.Controls
/// 最小值
/// </summary>
public static readonly DependencyProperty MinimumProperty = DependencyProperty.Register(
"Minimum", typeof(double), typeof(NumericUpDown), new PropertyMetadata(ValueBoxes.Double0Box, OnMinimumChanged, CoerceMinimum), ArithmeticHelper.IsValidDoubleValue);
"Minimum", typeof(double), typeof(NumericUpDown), new PropertyMetadata(ValueBoxes.Double0Box, OnMinimumChanged, CoerceMinimum), ValidateHelper.IsInRangeOfDouble);
private static void OnMinimumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
@@ -36,11 +36,11 @@ namespace HandyControl.Controls
public static readonly DependencyProperty DotCountProperty = DependencyProperty.Register(
"DotCount", typeof(int), typeof(LoadingBase),
new FrameworkPropertyMetadata(5, FrameworkPropertyMetadataOptions.AffectsRender));
new FrameworkPropertyMetadata(ValueBoxes.Int5Box, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty DotIntervalProperty = DependencyProperty.Register(
"DotInterval", typeof(double), typeof(LoadingBase),
new FrameworkPropertyMetadata(10.0, FrameworkPropertyMetadataOptions.AffectsRender));
new FrameworkPropertyMetadata(ValueBoxes.Double10Box, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty DotBorderBrushProperty = DependencyProperty.Register(
"DotBorderBrush", typeof(Brush), typeof(LoadingBase),
@@ -122,7 +122,7 @@ namespace HandyControl.Controls
StretchProperty.AddOwner(typeof(AnimationPath), new FrameworkPropertyMetadata(Stretch.Uniform,
OnPropertiesChanged));
StrokeThicknessProperty.AddOwner(typeof(AnimationPath), new FrameworkPropertyMetadata(1.0,
StrokeThicknessProperty.AddOwner(typeof(AnimationPath), new FrameworkPropertyMetadata(ValueBoxes.Double1Box,
OnPropertiesChanged));
}
@@ -85,21 +85,7 @@ namespace HandyControl.Controls
_id = ++NextId;
_callback = Callback;
Loaded += (s, e) =>
{
RegisterClass();
if (Visibility == Visibility.Visible)
{
OnIconChanged();
UpdateIcon(true);
}
_dispatcherTimerPos = new DispatcherTimer
{
Interval = TimeSpan.FromMilliseconds(200)
};
_dispatcherTimerPos.Tick += DispatcherTimerPos_Tick;
};
Loaded += (s, e) => Init();
if (Application.Current != null) Application.Current.Exit += (s, e) => Dispose();
}
@@ -109,6 +95,22 @@ namespace HandyControl.Controls
Dispose(false);
}
public void Init()
{
RegisterClass();
if (Visibility == Visibility.Visible)
{
OnIconChanged();
UpdateIcon(true);
}
_dispatcherTimerPos = new DispatcherTimer
{
Interval = TimeSpan.FromMilliseconds(200)
};
_dispatcherTimerPos.Tick += DispatcherTimerPos_Tick;
}
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
"Text", typeof(string), typeof(NotifyIcon), new PropertyMetadata(default(string)));
@@ -82,7 +82,7 @@ namespace HandyControl.Controls
/// 最大页数
/// </summary>
public static readonly DependencyProperty MaxPageCountProperty = DependencyProperty.Register(
"MaxPageCount", typeof(int), typeof(Pagination), new PropertyMetadata(1, (o, args) =>
"MaxPageCount", typeof(int), typeof(Pagination), new PropertyMetadata(ValueBoxes.Int1Box, (o, args) =>
{
if (o is Pagination pagination && args.NewValue is int value)
{
@@ -156,7 +156,7 @@ namespace HandyControl.Controls
/// 当前页
/// </summary>
public static readonly DependencyProperty PageIndexProperty = DependencyProperty.Register(
"PageIndex", typeof(int), typeof(Pagination), new PropertyMetadata(1, (o, args) =>
"PageIndex", typeof(int), typeof(Pagination), new PropertyMetadata(ValueBoxes.Int1Box, (o, args) =>
{
if (o is Pagination pagination && args.NewValue is int value)
{
@@ -312,7 +312,7 @@ namespace HandyControl.Controls
}
var sub = PageIndex;
for (int i = 0; i < MaxPageInterval - 1; i++)
for (var i = 0; i < MaxPageInterval - 1; i++)
{
if (--sub > 1)
{
@@ -324,7 +324,7 @@ namespace HandyControl.Controls
}
}
var add = PageIndex;
for (int i = 0; i < MaxPageInterval - 1; i++)
for (var i = 0; i < MaxPageInterval - 1; i++)
{
if (++add < MaxPageCount)
{
@@ -33,7 +33,7 @@ namespace HandyControl.Controls
base.OnVisualChildrenChanged(visualAdded, visualRemoved);
var count = Items.Count;
for (int i = 0; i < count; i++)
for (var i = 0; i < count; i++)
{
var item = (RadioButton)Items[i];
item.Style = ItemStyleSelector?.SelectStyle(item, this);
@@ -141,8 +141,41 @@ namespace HandyControl.Controls
}
else if (mode == ExpandMode.ShowOne)
{
var sideMenuItem = ItemsHost.Children.OfType<SideMenuItem>().FirstOrDefault(item => item.IsSelected);
ShowSelectedOne(sideMenuItem);
SideMenuItem sideMenuItemSelected = null;
foreach (var sideMenuItem in ItemsHost.Children.OfType<SideMenuItem>())
{
if (sideMenuItemSelected != null)
{
sideMenuItem.IsSelected = false;
if (sideMenuItem.ItemsHost != null)
{
foreach (var sideMenuSubItem in sideMenuItem.ItemsHost.Children.OfType<SideMenuItem>())
{
sideMenuSubItem.IsSelected = false;
}
}
}
else if (sideMenuItem.IsSelected)
{
ShowSelectedOne(sideMenuItem);
sideMenuItemSelected = sideMenuItem;
if (sideMenuItem.ItemsHost != null)
{
foreach (var sideMenuSubItem in sideMenuItem.ItemsHost.Children.OfType<SideMenuItem>())
{
if (_selectedItem != null)
{
sideMenuSubItem.IsSelected = false;
}
else if (sideMenuSubItem.IsSelected)
{
_selectedItem = sideMenuSubItem;
}
}
}
}
}
}
}
@@ -1,7 +1,6 @@
using System.Windows;
using System.Windows.Controls;
namespace HandyControl.Controls
{
public class CompareSlider : Slider
@@ -0,0 +1,653 @@
// Adapted from https://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/Controls/Slider.cs
using System;
using System.ComponentModel;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using HandyControl.Data;
using HandyControl.Expression.Drawing;
using HandyControl.Tools;
namespace HandyControl.Controls
{
[DefaultEvent("ValueChanged"), DefaultProperty("Value")]
[TemplatePart(Name = ElementTrack, Type = typeof(Track))]
public class RangeSlider : TwoWayRangeBase
{
private const string ElementTrack= "PART_Track";
private RangeTrack _track;
private readonly ToolTip _autoToolTipStart = null;
private readonly ToolTip _autoToolTipEnd = null;
private RangeThumb _thumbCurrent;
private object _thumbOriginalToolTip;
private Point _originThumbPoint;
private Point _previousScreenCoordPosition;
static RangeSlider()
{
InitializeCommands();
MinimumProperty.OverrideMetadata(typeof(RangeSlider), new FrameworkPropertyMetadata(ValueBoxes.Double0Box, FrameworkPropertyMetadataOptions.AffectsMeasure));
MaximumProperty.OverrideMetadata(typeof(RangeSlider), new FrameworkPropertyMetadata(ValueBoxes.Double10Box, FrameworkPropertyMetadataOptions.AffectsMeasure));
ValueStartProperty.OverrideMetadata(typeof(RangeSlider), new FrameworkPropertyMetadata(ValueBoxes.Double0Box, FrameworkPropertyMetadataOptions.AffectsMeasure));
ValueEndProperty.OverrideMetadata(typeof(RangeSlider), new FrameworkPropertyMetadata(ValueBoxes.Double0Box, FrameworkPropertyMetadataOptions.AffectsMeasure));
// Register Event Handler for the Thumb
EventManager.RegisterClassHandler(typeof(RangeSlider), Thumb.DragStartedEvent, new DragStartedEventHandler(OnThumbDragStarted));
EventManager.RegisterClassHandler(typeof(RangeSlider), Thumb.DragDeltaEvent, new DragDeltaEventHandler(OnThumbDragDelta));
EventManager.RegisterClassHandler(typeof(RangeSlider), Thumb.DragCompletedEvent, new DragCompletedEventHandler(OnThumbDragCompleted));
// Listen to MouseLeftButtonDown event to determine if slide should move focus to itself
EventManager.RegisterClassHandler(typeof(RangeSlider), Mouse.MouseDownEvent, new MouseButtonEventHandler(OnMouseLeftButtonDown), true);
}
public RangeSlider()
{
CommandBindings.Add(new CommandBinding(IncreaseLarge, OnIncreaseLarge));
CommandBindings.Add(new CommandBinding(IncreaseSmall, OnIncreaseSmall));
CommandBindings.Add(new CommandBinding(DecreaseLarge, OnDecreaseLarge));
CommandBindings.Add(new CommandBinding(DecreaseSmall, OnDecreaseSmall));
CommandBindings.Add(new CommandBinding(CenterLarge, OnCenterLarge));
CommandBindings.Add(new CommandBinding(CenterSmall, OnCenterSmall));
}
private void OnIncreaseLarge(object sender, ExecutedRoutedEventArgs e) => (sender as RangeSlider)?.OnIncreaseLarge();
private void OnIncreaseSmall(object sender, ExecutedRoutedEventArgs e) => (sender as RangeSlider)?.OnIncreaseSmall();
private void OnDecreaseLarge(object sender, ExecutedRoutedEventArgs e) => (sender as RangeSlider)?.OnDecreaseLarge();
private void OnDecreaseSmall(object sender, ExecutedRoutedEventArgs e) => (sender as RangeSlider)?.OnDecreaseSmall();
private void OnCenterLarge(object sender, ExecutedRoutedEventArgs e) => (sender as RangeSlider)?.OnCenterLarge(e.Parameter);
private void OnCenterSmall(object sender, ExecutedRoutedEventArgs e) => (sender as RangeSlider)?.OnCenterSmall(e.Parameter);
protected virtual void OnIncreaseLarge() => MoveToNextTick(LargeChange, false);
protected virtual void OnIncreaseSmall() => MoveToNextTick(LargeChange, false);
protected virtual void OnDecreaseLarge() => MoveToNextTick(-LargeChange, true);
protected virtual void OnDecreaseSmall() => MoveToNextTick(-LargeChange, true);
protected virtual void OnCenterLarge(object parameter) => MoveToNextTick(LargeChange, false, true);
protected virtual void OnCenterSmall(object parameter) => MoveToNextTick(LargeChange, false, true);
public static RoutedCommand IncreaseLarge { get; private set; }
public static RoutedCommand IncreaseSmall { get; private set; }
public static RoutedCommand DecreaseLarge { get; private set; }
public static RoutedCommand DecreaseSmall { get; private set; }
public static RoutedCommand CenterLarge { get; private set; }
public static RoutedCommand CenterSmall { get; private set; }
private static void InitializeCommands()
{
IncreaseLarge = new RoutedCommand(nameof(IncreaseLarge), typeof(RangeSlider));
IncreaseSmall = new RoutedCommand(nameof(IncreaseSmall), typeof(RangeSlider));
DecreaseLarge = new RoutedCommand(nameof(DecreaseLarge), typeof(RangeSlider));
DecreaseSmall = new RoutedCommand(nameof(DecreaseSmall), typeof(RangeSlider));
CenterLarge = new RoutedCommand(nameof(CenterLarge), typeof(RangeSlider));
CenterSmall = new RoutedCommand(nameof(CenterSmall), typeof(RangeSlider));
}
public override void OnApplyTemplate()
{
_thumbCurrent = null;
base.OnApplyTemplate();
_track = GetTemplateChild(ElementTrack) as RangeTrack;
if (_autoToolTipStart != null)
{
_autoToolTipStart.PlacementTarget = _track?.ThumbStart;
}
if (_autoToolTipEnd != null)
{
_autoToolTipEnd.PlacementTarget = _track?.ThumbEnd;
}
}
public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(
"Orientation", typeof(Orientation), typeof(RangeSlider), new PropertyMetadata(default(Orientation)));
public Orientation Orientation
{
get => (Orientation)GetValue(OrientationProperty);
set => SetValue(OrientationProperty, value);
}
public static readonly DependencyProperty IsDirectionReversedProperty = DependencyProperty.Register(
"IsDirectionReversed", typeof(bool), typeof(RangeSlider), new PropertyMetadata(ValueBoxes.FalseBox));
public bool IsDirectionReversed
{
get => (bool)GetValue(IsDirectionReversedProperty);
set => SetValue(IsDirectionReversedProperty, value);
}
public static readonly DependencyProperty DelayProperty = RepeatButton.DelayProperty.AddOwner(typeof(RangeSlider), new FrameworkPropertyMetadata(GetKeyboardDelay()));
public int Delay
{
get => (int)GetValue(DelayProperty);
set => SetValue(DelayProperty, value);
}
internal static int GetKeyboardDelay()
{
var delay = SystemParameters.KeyboardDelay;
if (delay < 0 || delay > 3)
delay = 0;
return (delay + 1) * 250;
}
public static readonly DependencyProperty IntervalProperty = RepeatButton.IntervalProperty.AddOwner(typeof(RangeSlider), new FrameworkPropertyMetadata(GetKeyboardSpeed()));
public int Interval
{
get => (int)GetValue(IntervalProperty);
set => SetValue(IntervalProperty, value);
}
internal static int GetKeyboardSpeed()
{
var speed = SystemParameters.KeyboardSpeed;
if (speed < 0 || speed > 31)
speed = 31;
return (31 - speed) * (400 - 1000 / 30) / 31 + 1000 / 30;
}
public static readonly DependencyProperty AutoToolTipPlacementProperty = DependencyProperty.Register(
"AutoToolTipPlacement", typeof(AutoToolTipPlacement), typeof(RangeSlider), new PropertyMetadata(default(AutoToolTipPlacement)));
public AutoToolTipPlacement AutoToolTipPlacement
{
get => (AutoToolTipPlacement)GetValue(AutoToolTipPlacementProperty);
set => SetValue(AutoToolTipPlacementProperty, value);
}
public static readonly DependencyProperty AutoToolTipPrecisionProperty = DependencyProperty.Register(
"AutoToolTipPrecision", typeof(int), typeof(RangeSlider), new PropertyMetadata(ValueBoxes.Int0Box),
ValidateHelper.IsInRangeOfPosIntIncludeZero);
public int AutoToolTipPrecision
{
get => (int)GetValue(AutoToolTipPrecisionProperty);
set => SetValue(AutoToolTipPrecisionProperty, value);
}
public static readonly DependencyProperty IsSnapToTickEnabledProperty = DependencyProperty.Register(
"IsSnapToTickEnabled", typeof(bool), typeof(RangeSlider), new PropertyMetadata(ValueBoxes.FalseBox));
public bool IsSnapToTickEnabled
{
get => (bool)GetValue(IsSnapToTickEnabledProperty);
set => SetValue(IsSnapToTickEnabledProperty, value);
}
public static readonly DependencyProperty TickPlacementProperty = DependencyProperty.Register(
"TickPlacement", typeof(TickPlacement), typeof(RangeSlider), new PropertyMetadata(default(TickPlacement)));
public TickPlacement TickPlacement
{
get => (TickPlacement)GetValue(TickPlacementProperty);
set => SetValue(TickPlacementProperty, value);
}
public static readonly DependencyProperty TickFrequencyProperty = DependencyProperty.Register(
"TickFrequency", typeof(double), typeof(RangeSlider), new PropertyMetadata(ValueBoxes.Double1Box),
ValidateHelper.IsInRangeOfPosDoubleIncludeZero);
public double TickFrequency
{
get => (double)GetValue(TickFrequencyProperty);
set => SetValue(TickFrequencyProperty, value);
}
public static readonly DependencyProperty TicksProperty = DependencyProperty.Register(
"Ticks", typeof(DoubleCollection), typeof(RangeSlider), new PropertyMetadata(new DoubleCollection()));
public DoubleCollection Ticks
{
get => (DoubleCollection)GetValue(TicksProperty);
set => SetValue(TicksProperty, value);
}
public static readonly DependencyProperty IsMoveToPointEnabledProperty = DependencyProperty.Register(
"IsMoveToPointEnabled", typeof(bool), typeof(RangeSlider), new PropertyMetadata(ValueBoxes.FalseBox));
public bool IsMoveToPointEnabled
{
get => (bool)GetValue(IsMoveToPointEnabledProperty);
set => SetValue(IsMoveToPointEnabledProperty, value);
}
protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
{
if (IsMoveToPointEnabled && _track.ThumbStart != null && !_track.ThumbStart.IsMouseOver && _track.ThumbEnd != null && !_track.ThumbEnd.IsMouseOver)
{
// Here we need to determine whether it's closer to the starting point or the end point.
var pt = e.MouseDevice.GetPosition(_track);
UpdateValue(pt);
e.Handled = true;
}
base.OnPreviewMouseLeftButtonDown(e);
}
private void MoveToNextTick(double direction, bool isStart, bool isCenter = false, object parameter = null)
{
if (MathHelper.AreClose(direction, 0)) return;
if (isCenter)
{
if (parameter == null)
{
var pt = Mouse.GetPosition(_track);
var newValue = _track.ValueFromPoint(pt);
if (ValidateHelper.IsInRangeOfDouble(newValue))
{
var dir = (ValueStart + ValueEnd) / 2 > newValue;
if (!dir)
{
isStart = false;
direction = -Math.Abs(direction);
}
else
{
isStart = true;
}
}
}
if (parameter is bool parameterValue)
{
isStart = parameterValue;
}
}
var value = isStart ? ValueStart : ValueEnd;
var next = SnapToTick(Math.Max(Minimum, Math.Min(Maximum, value + direction)));
var greaterThan = direction > 0;
// If the snapping brought us back to value, find the next tick point
if (MathHelper.AreClose(next, value) &&
!(greaterThan && MathHelper.AreClose(value, Maximum)) &&
!(!greaterThan && MathHelper.AreClose(value, Minimum)))
{
// If ticks collection is available, use it.
// Note that ticks may be unsorted.
if (Ticks != null && Ticks.Count > 0)
{
foreach (var tick in Ticks)
{
// Find the smallest tick greater than value or the largest tick less than value
if (greaterThan && MathHelper.GreaterThan(tick, value) && (MathHelper.LessThan(tick, next) || MathHelper.AreClose(next, value))
|| !greaterThan && MathHelper.LessThan(tick, value) && (MathHelper.GreaterThan(tick, next) || MathHelper.AreClose(next, value)))
{
next = tick;
}
}
}
else if (MathHelper.GreaterThan(TickFrequency, 0.0))
{
// Find the current tick we are at
var tickNumber = Math.Round((value - Minimum) / TickFrequency);
if (greaterThan)
tickNumber += 1.0;
else
tickNumber -= 1.0;
next = Minimum + tickNumber * TickFrequency;
}
}
// Update if we've found a better value
if (!MathHelper.AreClose(next, value))
{
SetCurrentValue(isStart ? ValueStartProperty : ValueEndProperty, next);
}
}
private double SnapToTick(double value)
{
if (!IsSnapToTickEnabled) return value;
var previous = Minimum;
var next = Maximum;
if (Ticks != null && Ticks.Count > 0)
{
foreach (var tick in Ticks)
{
if (MathHelper.AreClose(tick, value))
{
return value;
}
if (MathHelper.LessThan(tick, value) && MathHelper.GreaterThan(tick, previous))
{
previous = tick;
}
else if (MathHelper.GreaterThan(tick, value) && MathHelper.LessThan(tick, next))
{
next = tick;
}
}
}
else if (MathHelper.GreaterThan(TickFrequency, 0.0))
{
previous = Minimum + Math.Round((value - Minimum) / TickFrequency) * TickFrequency;
next = Math.Min(Maximum, previous + TickFrequency);
}
return MathHelper.GreaterThanOrClose(value, (previous + next) * 0.5) ? next : previous;
}
private void UpdateValue(Point point)
{
var newValue = _track.ValueFromPoint(point);
if (ValidateHelper.IsInRangeOfDouble(newValue))
{
var isStart = (ValueStart + ValueEnd) / 2 > newValue;
UpdateValue(newValue, isStart);
}
}
private void UpdateValue(double value, bool isStart)
{
var snappedValue = SnapToTick(value);
if (isStart)
{
if (!MathHelper.AreClose(snappedValue, ValueStart))
{
var start = Math.Max(Minimum, Math.Min(Maximum, snappedValue));
if (start > ValueEnd)
{
SetCurrentValue(ValueEndProperty, start);
_track.ThumbStart.CancelDrag();
_track.ThumbEnd.StartDrag();
_thumbCurrent = _track.ThumbEnd;
}
else
{
SetCurrentValue(ValueStartProperty, start);
}
}
}
else
{
if (!MathHelper.AreClose(snappedValue, ValueEnd))
{
var end = Math.Max(Minimum, Math.Min(Maximum, snappedValue));
if (end < ValueStart)
{
SetCurrentValue(ValueStartProperty, end);
_track.ThumbEnd.CancelDrag();
_track.ThumbStart.StartDrag();
_thumbCurrent = _track.ThumbStart;
}
else
{
SetCurrentValue(ValueEndProperty, end);
}
}
}
}
private static void OnThumbDragStarted(object sender, DragStartedEventArgs e) => (sender as RangeSlider)?.OnThumbDragStarted(e);
protected virtual void OnThumbDragStarted(DragStartedEventArgs e)
{
// Show AutoToolTip if needed.
if (!(e.OriginalSource is RangeThumb thumb)) return;
_thumbCurrent = thumb;
_originThumbPoint = Mouse.GetPosition(_thumbCurrent);
_thumbCurrent.StartDrag();
if (AutoToolTipPlacement == AutoToolTipPlacement.None)
{
return;
}
var isStart = thumb.Equals(_track.ThumbStart);
if (!isStart)
{
if (!thumb.Equals(_track.ThumbEnd)) return;
}
// Save original tooltip
_thumbOriginalToolTip = thumb.ToolTip;
OnThumbDragStarted(isStart ? _autoToolTipStart : _autoToolTipEnd, isStart);
}
private void OnThumbDragStarted(ToolTip toolTip, bool isStart)
{
if (toolTip == null)
{
toolTip = new ToolTip
{
Placement = PlacementMode.Custom,
PlacementTarget = isStart ? _track.ThumbStart : _track.ThumbEnd,
CustomPopupPlacementCallback = AutoToolTipCustomPlacementCallback
};
}
if (isStart)
{
_track.ThumbStart.ToolTip = toolTip;
}
else
{
_track.ThumbEnd.ToolTip = toolTip;
}
toolTip.Content = GetAutoToolTipNumber(isStart);
toolTip.IsOpen = true;
}
private CustomPopupPlacement[] AutoToolTipCustomPlacementCallback(Size popupSize, Size targetSize, Point offset)
{
switch (AutoToolTipPlacement)
{
case AutoToolTipPlacement.TopLeft:
if (Orientation == Orientation.Horizontal)
{
// Place popup at top of thumb
return new[]{new CustomPopupPlacement(
new Point((targetSize.Width - popupSize.Width) * 0.5, -popupSize.Height),
PopupPrimaryAxis.Horizontal)
};
}
else
{
// Place popup at left of thumb
return new[] {
new CustomPopupPlacement(
new Point(-popupSize.Width, (targetSize.Height - popupSize.Height) * 0.5),
PopupPrimaryAxis.Vertical)
};
}
case AutoToolTipPlacement.BottomRight:
if (Orientation == Orientation.Horizontal)
{
// Place popup at bottom of thumb
return new[] {
new CustomPopupPlacement(
new Point((targetSize.Width - popupSize.Width) * 0.5, targetSize.Height) ,
PopupPrimaryAxis.Horizontal)
};
}
else
{
// Place popup at right of thumb
return new[] {
new CustomPopupPlacement(
new Point(targetSize.Width, (targetSize.Height - popupSize.Height) * 0.5),
PopupPrimaryAxis.Vertical)
};
}
default:
return new CustomPopupPlacement[] { };
}
}
private string GetAutoToolTipNumber(bool isStart)
{
var format = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();
format.NumberDecimalDigits = AutoToolTipPrecision;
return isStart ? ValueStart.ToString("N", format) : ValueEnd.ToString("N", format);
}
private static void OnThumbDragDelta(object sender, DragDeltaEventArgs e) => (sender as RangeSlider)?.OnThumbDragDelta(e);
protected virtual void OnThumbDragDelta(DragDeltaEventArgs e)
{
if (!(e.OriginalSource is Thumb thumb)) return;
var isStart = thumb.Equals(_track.ThumbStart);
if (!isStart)
{
if (!thumb.Equals(_track.ThumbEnd)) return;
}
// Convert to Track's co-ordinate
OnThumbDragDelta(_track, isStart, e);
}
private void OnThumbDragDelta(RangeTrack track, bool isStart, DragDeltaEventArgs e)
{
if (track == null || track.ThumbStart == null | _track.ThumbEnd == null) return;
var newValue = (isStart ? ValueStart : ValueEnd) + track.ValueFromDistance(e.HorizontalChange, e.VerticalChange);
if (ValidateHelper.IsInRangeOfDouble(newValue))
{
UpdateValue(newValue, isStart);
}
// Show AutoToolTip if needed
if (AutoToolTipPlacement != AutoToolTipPlacement.None)
{
var toolTip = (isStart ? _autoToolTipStart : _autoToolTipEnd) ?? new ToolTip();
toolTip.Content = GetAutoToolTipNumber(isStart);
var thumb = isStart ? _track.ThumbStart : _track.ThumbEnd;
if (!Equals(thumb.ToolTip, toolTip))
{
thumb.ToolTip = toolTip;
}
if (!toolTip.IsOpen)
{
toolTip.IsOpen = true;
}
}
}
private static void OnThumbDragCompleted(object sender, DragCompletedEventArgs e) => (sender as RangeSlider)?.OnThumbDragCompleted(e);
protected virtual void OnThumbDragCompleted(DragCompletedEventArgs e)
{
// Show AutoToolTip if needed.
if (!(e.OriginalSource is Thumb thumb) || AutoToolTipPlacement == AutoToolTipPlacement.None)
{
return;
}
var isStart = thumb.Equals(_track.ThumbStart);
if (!isStart)
{
if (!thumb.Equals(_track.ThumbEnd)) return;
}
var toolTip = isStart ? _autoToolTipStart : _autoToolTipEnd;
if (toolTip != null)
{
toolTip.IsOpen = false;
}
thumb.ToolTip = _thumbOriginalToolTip;
}
private static void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton != MouseButton.Left) return;
var slider = (RangeSlider)sender;
// When someone click on the Slider's part, and it's not focusable
// Slider need to take the focus in order to process keyboard correctly
if (!slider.IsKeyboardFocusWithin)
{
e.Handled = slider.Focus() || e.Handled;
}
if (slider._track.ThumbStart.IsMouseOver)
{
slider._track.ThumbStart.StartDrag();
slider._thumbCurrent = slider._track.ThumbStart;
}
if (slider._track.ThumbEnd.IsMouseOver)
{
slider._track.ThumbEnd.StartDrag();
slider._thumbCurrent = slider._track.ThumbEnd;
}
}
protected override void OnMouseMove(MouseEventArgs e)
{
if (_thumbCurrent == null) return;
if (e.MouseDevice.LeftButton != MouseButtonState.Pressed) return;
if (!_thumbCurrent.IsDragging) return;
var thumbCoordPosition = e.GetPosition(_thumbCurrent);
var screenCoordPosition = PointFromScreen(thumbCoordPosition);
if (screenCoordPosition != _previousScreenCoordPosition)
{
_previousScreenCoordPosition = screenCoordPosition;
_thumbCurrent.RaiseEvent(new DragDeltaEventArgs(thumbCoordPosition.X - _originThumbPoint.X,
thumbCoordPosition.Y - _originThumbPoint.Y));
}
}
protected override void OnPreviewMouseLeftButtonUp(MouseButtonEventArgs e)
{
base.OnPreviewMouseLeftButtonUp(e);
_thumbCurrent = null;
}
}
}
@@ -0,0 +1,46 @@
using System;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
namespace HandyControl.Controls
{
public class RangeThumb : Thumb
{
public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(
"Content", typeof(object), typeof(RangeThumb), new PropertyMetadata(default(object)));
public object Content
{
get => GetValue(ContentProperty);
set => SetValue(ContentProperty, value);
}
protected override void OnMouseMove(MouseEventArgs e)
{
}
public void StartDrag()
{
IsDragging = true;
Focus();
CaptureMouse();
RaiseEvent(new MouseButtonEventArgs(Mouse.PrimaryDevice, Environment.TickCount, MouseButton.Left)
{
RoutedEvent = PreviewMouseLeftButtonDownEvent,
Source = this
});
}
public new void CancelDrag()
{
base.CancelDrag();
RaiseEvent(new MouseButtonEventArgs(Mouse.PrimaryDevice, Environment.TickCount, MouseButton.Left)
{
RoutedEvent = PreviewMouseLeftButtonUpEvent
});
}
}
}
@@ -0,0 +1,444 @@
// Adapted from https://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/Controls/Primitives/Track.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using HandyControl.Data;
namespace HandyControl.Controls
{
public class RangeTrack : FrameworkElement
{
private RepeatButton _increaseButton;
private RepeatButton _centerButton;
private RepeatButton _decreaseButton;
private RangeThumb _thumbStart;
private RangeThumb _thumbEnd;
private Visual[] _visualChildren;
private double Density { get; set; } = double.NaN;
private double ThumbStartCenterOffset { get; set; } = double.NaN;
public RepeatButton DecreaseRepeatButton
{
get => _decreaseButton;
set
{
if (Equals(_increaseButton, value) || Equals(_centerButton, value))
{
throw new NotSupportedException("SameButtons");
}
UpdateComponent(_decreaseButton, value);
_decreaseButton = value;
if (_decreaseButton != null)
{
CommandManager.InvalidateRequerySuggested(); // Should post an idle queue item to update IsEnabled on button
}
}
}
public RepeatButton CenterRepeatButton
{
get => _centerButton;
set
{
if (Equals(_increaseButton, value) || Equals(_decreaseButton, value))
{
throw new NotSupportedException("SameButtons");
}
UpdateComponent(_centerButton, value);
_centerButton = value;
if (_centerButton != null)
{
CommandManager.InvalidateRequerySuggested(); // Should post an idle queue item to update IsEnabled on button
}
}
}
public RepeatButton IncreaseRepeatButton
{
get => _increaseButton;
set
{
if (Equals(_decreaseButton, value) || Equals(_centerButton, value))
{
throw new NotSupportedException("SameButtons");
}
UpdateComponent(_increaseButton, value);
_increaseButton = value;
if (_increaseButton != null)
{
CommandManager.InvalidateRequerySuggested(); // Should post an idle queue item to update IsEnabled on button
}
}
}
public RangeThumb ThumbStart
{
get => _thumbStart;
set
{
UpdateComponent(_thumbStart, value);
_thumbStart = value;
}
}
public RangeThumb ThumbEnd
{
get => _thumbEnd;
set
{
UpdateComponent(_thumbEnd, value);
_thumbEnd = value;
}
}
static RangeTrack()
{
IsEnabledProperty.OverrideMetadata(typeof(RangeTrack), new UIPropertyMetadata(OnIsEnabledChanged));
}
public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(
"Orientation", typeof(Orientation), typeof(RangeTrack),
new FrameworkPropertyMetadata(default(Orientation), FrameworkPropertyMetadataOptions.AffectsMeasure));
public Orientation Orientation
{
get => (Orientation) GetValue(OrientationProperty);
set => SetValue(OrientationProperty, value);
}
public static readonly DependencyProperty MinimumProperty = DependencyProperty.Register(
"Minimum", typeof(double), typeof(RangeTrack),
new FrameworkPropertyMetadata(ValueBoxes.Double0Box, FrameworkPropertyMetadataOptions.AffectsArrange));
public double Minimum
{
get => (double) GetValue(MinimumProperty);
set => SetValue(MinimumProperty, value);
}
public static readonly DependencyProperty MaximumProperty = DependencyProperty.Register(
"Maximum", typeof(double), typeof(RangeTrack),
new FrameworkPropertyMetadata(ValueBoxes.Double1Box, FrameworkPropertyMetadataOptions.AffectsArrange));
public double Maximum
{
get => (double) GetValue(MaximumProperty);
set => SetValue(MaximumProperty, value);
}
public static readonly DependencyProperty ValueStartProperty = DependencyProperty.Register(
"ValueStart", typeof(double), typeof(RangeTrack),
new FrameworkPropertyMetadata(ValueBoxes.Double0Box,
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault |
FrameworkPropertyMetadataOptions.AffectsArrange));
public double ValueStart
{
get => (double) GetValue(ValueStartProperty);
set => SetValue(ValueStartProperty, value);
}
public static readonly DependencyProperty ValueEndProperty = DependencyProperty.Register(
"ValueEnd", typeof(double), typeof(RangeTrack),
new FrameworkPropertyMetadata(ValueBoxes.Double0Box,
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault |
FrameworkPropertyMetadataOptions.AffectsArrange));
public double ValueEnd
{
get => (double) GetValue(ValueEndProperty);
set => SetValue(ValueEndProperty, value);
}
public static readonly DependencyProperty IsDirectionReversedProperty = DependencyProperty.Register(
"IsDirectionReversed", typeof(bool), typeof(RangeTrack), new PropertyMetadata(ValueBoxes.FalseBox));
public bool IsDirectionReversed
{
get => (bool) GetValue(IsDirectionReversedProperty);
set => SetValue(IsDirectionReversedProperty, value);
}
protected override Visual GetVisualChild(int index)
{
if (_visualChildren?[index] == null)
{
// ReSharper disable once UseNameofExpression
// ReSharper disable once LocalizableElement
throw new ArgumentOutOfRangeException("index", index, "ArgumentOutOfRange");
}
return _visualChildren[index];
}
protected override Size MeasureOverride(Size availableSize)
{
var desiredSize = new Size();
// Only measure thumb
// Repeat buttons will be sized based on thumb
if (_thumbStart != null)
{
_thumbStart.Measure(availableSize);
desiredSize = _thumbStart.DesiredSize;
}
if (_thumbEnd != null)
{
_thumbEnd.Measure(availableSize);
desiredSize = new Size(Math.Max(_thumbEnd.DesiredSize.Width, desiredSize.Width),
Math.Max(_thumbEnd.DesiredSize.Height, desiredSize.Height));
}
return desiredSize;
}
private static void CoerceLength(ref double componentLength, double trackLength)
{
if (componentLength < 0)
{
componentLength = 0;
}
else if (componentLength > trackLength || double.IsNaN(componentLength))
{
componentLength = trackLength;
}
}
protected override Size ArrangeOverride(Size arrangeSize)
{
var isVertical = Orientation == Orientation.Vertical;
ComputeLengths(arrangeSize, isVertical, out var decreaseButtonLength, out var centerButtonLength,
out var increaseButtonLength, out var thumbStartLength, out var thumbEndLength);
var offset = new Point();
var pieceSize = arrangeSize;
var isDirectionReversed = IsDirectionReversed;
if (isVertical)
{
CoerceLength(ref decreaseButtonLength, arrangeSize.Height);
CoerceLength(ref centerButtonLength, arrangeSize.Height);
CoerceLength(ref increaseButtonLength, arrangeSize.Height);
CoerceLength(ref thumbStartLength, arrangeSize.Height);
CoerceLength(ref thumbEndLength, arrangeSize.Height);
offset.Y = isDirectionReversed ? decreaseButtonLength + thumbEndLength + centerButtonLength + thumbStartLength : 0;
pieceSize.Height = increaseButtonLength;
IncreaseRepeatButton?.Arrange(new Rect(offset, pieceSize));
offset.Y = isDirectionReversed ? decreaseButtonLength + thumbEndLength : increaseButtonLength + thumbStartLength;
pieceSize.Height = centerButtonLength;
CenterRepeatButton?.Arrange(new Rect(offset, pieceSize));
offset.Y = isDirectionReversed ? 0 : increaseButtonLength + thumbStartLength + centerButtonLength + thumbEndLength;
pieceSize.Height = decreaseButtonLength;
DecreaseRepeatButton?.Arrange(new Rect(offset, pieceSize));
offset.Y = isDirectionReversed
? decreaseButtonLength + thumbEndLength + centerButtonLength
: increaseButtonLength + thumbStartLength + centerButtonLength;
pieceSize.Height = thumbStartLength;
ThumbStart?.Arrange(new Rect(offset, pieceSize));
ThumbStartCenterOffset = offset.Y + thumbStartLength * 0.5;
offset.Y = isDirectionReversed ? decreaseButtonLength : increaseButtonLength;
pieceSize.Height = thumbEndLength;
ThumbEnd?.Arrange(new Rect(offset, pieceSize));
}
else
{
CoerceLength(ref decreaseButtonLength, arrangeSize.Width);
CoerceLength(ref centerButtonLength, arrangeSize.Width);
CoerceLength(ref increaseButtonLength, arrangeSize.Width);
CoerceLength(ref thumbStartLength, arrangeSize.Width);
CoerceLength(ref thumbEndLength, arrangeSize.Width);
offset.X = isDirectionReversed ? 0 : decreaseButtonLength + thumbEndLength + centerButtonLength + thumbStartLength;
pieceSize.Width = increaseButtonLength;
IncreaseRepeatButton?.Arrange(new Rect(offset, pieceSize));
offset.X = isDirectionReversed ? increaseButtonLength + thumbStartLength : decreaseButtonLength + thumbEndLength;
pieceSize.Width = centerButtonLength;
CenterRepeatButton?.Arrange(new Rect(offset, pieceSize));
offset.X = isDirectionReversed ? increaseButtonLength + thumbStartLength + centerButtonLength + thumbEndLength : 0;
pieceSize.Width = decreaseButtonLength;
DecreaseRepeatButton?.Arrange(new Rect(offset, pieceSize));
offset.X = isDirectionReversed ? increaseButtonLength : decreaseButtonLength;
pieceSize.Width = thumbStartLength;
ThumbStart?.Arrange(new Rect(offset, pieceSize));
ThumbStartCenterOffset = offset.X + thumbStartLength * 0.5;
offset.X = isDirectionReversed
? increaseButtonLength + thumbStartLength + centerButtonLength
: decreaseButtonLength + thumbEndLength + centerButtonLength;
pieceSize.Width = thumbEndLength;
ThumbEnd?.Arrange(new Rect(offset, pieceSize));
}
return arrangeSize;
}
private void ComputeLengths(Size arrangeSize, bool isVertical, out double decreaseButtonLength,
out double centerButtonLength, out double increaseButtonLength, out double thumbStartLength,
out double thumbEndLength)
{
var min = Minimum;
var range = Math.Max(0.0, Maximum - min);
var offsetStart = Math.Min(range, ValueStart - min);
var offsetEnd = Math.Min(range, ValueEnd - min);
double trackLength;
// Compute thumb size
if (isVertical)
{
trackLength = arrangeSize.Height;
thumbStartLength = _thumbStart?.DesiredSize.Height ?? 0;
thumbEndLength = _thumbEnd?.DesiredSize.Height ?? 0;
}
else
{
trackLength = arrangeSize.Width;
thumbStartLength = _thumbStart?.DesiredSize.Width ?? 0;
thumbEndLength = _thumbEnd?.DesiredSize.Width ?? 0;
}
CoerceLength(ref thumbStartLength, trackLength);
CoerceLength(ref thumbEndLength, trackLength);
var remainingTrackLength = trackLength - thumbStartLength - thumbEndLength;
decreaseButtonLength = remainingTrackLength * offsetStart / range;
CoerceLength(ref decreaseButtonLength, remainingTrackLength);
centerButtonLength = remainingTrackLength * offsetEnd / range - decreaseButtonLength;
CoerceLength(ref centerButtonLength, remainingTrackLength);
increaseButtonLength = remainingTrackLength - decreaseButtonLength - centerButtonLength;
CoerceLength(ref increaseButtonLength, remainingTrackLength);
Density = range / remainingTrackLength;
}
protected override int VisualChildrenCount
{
get
{
if (_visualChildren == null) return 0;
for (var i = 0; i < _visualChildren.Length; i++)
{
if (_visualChildren[i] == null) return i;
}
return _visualChildren.Length;
}
}
private static void OnIsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if ((bool)e.NewValue)
{
Mouse.Synchronize();
}
}
public virtual double ValueFromPoint(Point pt)
{
double val;
// Find distance from center of thumb to given point.
if (Orientation == Orientation.Horizontal)
{
val = ValueStart + ValueFromDistance(pt.X - ThumbStartCenterOffset, pt.Y - RenderSize.Height * 0.5);
}
else
{
val = ValueStart + ValueFromDistance(pt.X - RenderSize.Width * 0.5, pt.Y - ThumbStartCenterOffset);
}
return Math.Max(Minimum, Math.Min(Maximum, val));
}
public virtual double ValueFromDistance(double horizontal, double vertical)
{
double scale = IsDirectionReversed ? -1 : 1;
return Orientation == Orientation.Horizontal
? scale * horizontal * Density
: -1 * scale * vertical * Density;
}
private void UpdateComponent(Control oldValue, Control newValue)
{
if (oldValue != newValue)
{
if (_visualChildren == null)
{
_visualChildren = new Visual[5];
}
if (oldValue != null)
{
// notify the visual layer that the old component has been removed.
RemoveVisualChild(oldValue);
}
// Remove the old value from our z index list and add new value to end
int i = 0;
while (i < 5)
{
// Array isn't full, break
if (_visualChildren[i] == null)
break;
// found the old value
if (_visualChildren[i] == oldValue)
{
// Move values down until end of array or a null element
while (i < 4 && _visualChildren[i + 1] != null)
{
_visualChildren[i] = _visualChildren[i + 1];
i++;
}
}
else
{
i++;
}
}
// Add newValue at end of z-order
_visualChildren[i] = newValue;
AddVisualChild(newValue);
InvalidateMeasure();
InvalidateArrange();
}
}
}
}
@@ -0,0 +1,181 @@
// Adapted from https://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/Controls/Primitives/RangeBase.cs
using HandyControl.Data;
using HandyControl.Tools;
using System.Windows;
using System.Windows.Controls;
namespace HandyControl.Controls
{
public class TwoWayRangeBase : Control
{
public static readonly DependencyProperty MinimumProperty = DependencyProperty.Register(
"Minimum", typeof(double), typeof(TwoWayRangeBase),
new PropertyMetadata(ValueBoxes.Double0Box, OnMinimumChanged), ValidateHelper.IsInRangeOfDouble);
private static void OnMinimumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var ctrl = (TwoWayRangeBase)d;
ctrl.CoerceValue(MaximumProperty);
ctrl.CoerceValue(ValueStartProperty);
ctrl.CoerceValue(ValueEndProperty);
ctrl.OnMinimumChanged((double)e.OldValue, (double)e.NewValue);
}
protected virtual void OnMinimumChanged(double oldMinimum, double newMinimum)
{
}
public double Minimum
{
get => (double)GetValue(MinimumProperty);
set => SetValue(MinimumProperty, value);
}
public static readonly DependencyProperty MaximumProperty = DependencyProperty.Register(
"Maximum", typeof(double), typeof(TwoWayRangeBase),
new PropertyMetadata(ValueBoxes.Double10Box, OnMaximumChanged, CoerceMaximum),
ValidateHelper.IsInRangeOfDouble);
private static object CoerceMaximum(DependencyObject d, object basevalue)
{
var ctrl = (TwoWayRangeBase)d;
var min = ctrl.Minimum;
if ((double)basevalue < min)
{
return min;
}
return basevalue;
}
private static void OnMaximumChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var ctrl = (TwoWayRangeBase)d;
ctrl.CoerceValue(ValueStartProperty);
ctrl.CoerceValue(ValueEndProperty);
ctrl.OnMaximumChanged((double)e.OldValue, (double)e.NewValue);
}
protected virtual void OnMaximumChanged(double oldMaximum, double newMaximum)
{
}
public double Maximum
{
get => (double)GetValue(MaximumProperty);
set => SetValue(MaximumProperty, value);
}
public static readonly DependencyProperty ValueStartProperty = DependencyProperty.Register(
"ValueStart", typeof(double), typeof(TwoWayRangeBase),
new FrameworkPropertyMetadata(ValueBoxes.Double0Box,
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
OnValueStartChanged, ConstrainToRange), ValidateHelper.IsInRangeOfDouble);
private static void OnValueStartChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var ctrl = (TwoWayRangeBase)d;
ctrl.OnValueChanged(new TwoWayRange
{
ValueStart = (double)e.OldValue,
ValueEnd = ctrl.ValueEnd
}, new TwoWayRange
{
ValueStart = (double)e.NewValue,
ValueEnd = ctrl.ValueEnd
});
}
protected virtual void OnValueChanged(TwoWayRange oldValue, TwoWayRange newValue) => RaiseEvent(
new RoutedPropertyChangedEventArgs<TwoWayRange>(oldValue, newValue) {RoutedEvent = ValueChangedEvent});
public double ValueStart
{
get => (double)GetValue(ValueStartProperty);
set => SetValue(ValueStartProperty, value);
}
public static readonly DependencyProperty ValueEndProperty = DependencyProperty.Register(
"ValueEnd", typeof(double), typeof(TwoWayRangeBase),
new FrameworkPropertyMetadata(ValueBoxes.Double0Box,
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
OnValueEndChanged, ConstrainToRange), ValidateHelper.IsInRangeOfDouble);
private static void OnValueEndChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var ctrl = (TwoWayRangeBase)d;
ctrl.OnValueChanged(new TwoWayRange
{
ValueStart = ctrl.ValueStart,
ValueEnd = (double)e.OldValue
}, new TwoWayRange
{
ValueStart = ctrl.ValueStart,
ValueEnd = (double)e.NewValue
});
}
public double ValueEnd
{
get => (double)GetValue(ValueEndProperty);
set => SetValue(ValueEndProperty, value);
}
internal static object ConstrainToRange(DependencyObject d, object value)
{
var ctrl = (TwoWayRangeBase)d;
var min = ctrl.Minimum;
var v = (double)value;
if (v < min)
{
return min;
}
var max = ctrl.Maximum;
if (v > max)
{
return max;
}
return value;
}
public static readonly DependencyProperty LargeChangeProperty = DependencyProperty.Register(
"LargeChange", typeof(double), typeof(TwoWayRangeBase), new PropertyMetadata(ValueBoxes.Double1Box),
ValidateHelper.IsInRangeOfPosDoubleIncludeZero);
public double LargeChange
{
get => (double)GetValue(LargeChangeProperty);
set => SetValue(LargeChangeProperty, value);
}
public static readonly DependencyProperty SmallChangeProperty = DependencyProperty.Register(
"SmallChange", typeof(double), typeof(TwoWayRangeBase), new PropertyMetadata(ValueBoxes.Double01Box),
ValidateHelper.IsInRangeOfPosDoubleIncludeZero);
public double SmallChange
{
get => (double)GetValue(SmallChangeProperty);
set => SetValue(SmallChangeProperty, value);
}
public static readonly RoutedEvent ValueChangedEvent = EventManager.RegisterRoutedEvent("ValueChanged",
RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler<TwoWayRange>), typeof(TwoWayRangeBase));
public event RoutedPropertyChangedEventHandler<TwoWayRange> ValueChanged
{
add => AddHandler(ValueChangedEvent, value);
remove => RemoveHandler(ValueChangedEvent, value);
}
}
public struct TwoWayRange
{
public double ValueStart { get; set; }
public double ValueEnd { get; set; }
}
}
@@ -38,7 +38,7 @@ namespace HandyControl.Controls
var count = Items.Count;
if (count <= 0) return;
for (int i = 0; i < count; i++)
for (var i = 0; i < count; i++)
{
if (ItemContainerGenerator.ContainerFromIndex(i) is StepBarItem stepBarItem)
{
@@ -48,7 +48,7 @@ namespace HandyControl.Controls
if (StepIndex < count)
{
for (int i = 0; i < StepIndex; i++)
for (var i = 0; i < StepIndex; i++)
{
if (ItemContainerGenerator.ContainerFromIndex(i) is StepBarItem stepBarItem)
{
@@ -102,7 +102,7 @@ namespace HandyControl.Controls
private void CreateItemsSource(ItemsControl selector, int count)
{
var list = new List<string>();
for (int i = 0; i < count; i++)
for (var i = 0; i < count; i++)
{
list.Add(i.ToString("#00"));
}
@@ -1,5 +1,7 @@
using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Media;
using System.Text;
using System.Windows;
using System.Windows.Input;
@@ -13,6 +15,7 @@ namespace HandyControl.Controls
/// <summary>
/// 消息框
/// </summary>
[SuppressMessage("ReSharper", "RedundantDelegateCreation")]
public sealed class MessageBox : Window
{
private MessageBoxResult _messageBoxResult = MessageBoxResult.Cancel;
@@ -30,7 +33,7 @@ namespace HandyControl.Controls
public string Message
{
get => (string) GetValue(MessageProperty);
get => (string)GetValue(MessageProperty);
set => SetValue(MessageProperty, value);
}
@@ -39,7 +42,7 @@ namespace HandyControl.Controls
public Geometry Image
{
get => (Geometry) GetValue(ImageProperty);
get => (Geometry)GetValue(ImageProperty);
set => SetValue(ImageProperty, value);
}
@@ -48,7 +51,7 @@ namespace HandyControl.Controls
public Brush ImageBrush
{
get => (Brush) GetValue(ImageBrushProperty);
get => (Brush)GetValue(ImageBrushProperty);
set => SetValue(ImageBrushProperty, value);
}
@@ -57,7 +60,7 @@ namespace HandyControl.Controls
public bool ShowImage
{
get => (bool) GetValue(ShowImageProperty);
get => (bool)GetValue(ShowImageProperty);
set => SetValue(ShowImageProperty, value);
}
@@ -138,7 +141,6 @@ namespace HandyControl.Controls
public static MessageBoxResult Success(string messageBoxText, string caption = null)
{
MessageBox messageBox = null;
#if netle40
Application.Current.Dispatcher.Invoke(new Action(() =>
{
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
@@ -146,19 +148,9 @@ namespace HandyControl.Controls
messageBox.ShowImage = true;
messageBox.Image = ResourceHelper.GetResource<Geometry>(ResourceToken.SuccessGeometry);
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(ResourceToken.SuccessBrush);
SystemSounds.Asterisk.Play();
messageBox.ShowDialog();
}));
#else
Application.Current.Dispatcher.Invoke(() =>
{
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
SetButtonStatus(messageBox, MessageBoxButton.OK);
messageBox.ShowImage = true;
messageBox.Image = ResourceHelper.GetResource<Geometry>(ResourceToken.SuccessGeometry);
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(ResourceToken.SuccessBrush);
messageBox.ShowDialog();
});
#endif
return messageBox._messageBoxResult;
}
@@ -171,23 +163,14 @@ namespace HandyControl.Controls
public static MessageBoxResult Info(string messageBoxText, string caption = null)
{
MessageBox messageBox = null;
#if netle40
Application.Current.Dispatcher.Invoke(new Action(() =>
{
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
SetButtonStatus(messageBox, MessageBoxButton.OK);
SetImage(messageBox, MessageBoxImage.Information);
SystemSounds.Asterisk.Play();
messageBox.ShowDialog();
}));
#else
Application.Current.Dispatcher.Invoke(() =>
{
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
SetButtonStatus(messageBox, MessageBoxButton.OK);
SetImage(messageBox, MessageBoxImage.Information);
messageBox.ShowDialog();
});
#endif
return messageBox._messageBoxResult;
}
@@ -200,23 +183,14 @@ namespace HandyControl.Controls
public static MessageBoxResult Warning(string messageBoxText, string caption = null)
{
MessageBox messageBox = null;
#if netle40
Application.Current.Dispatcher.Invoke(new Action(() =>
{
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
SetButtonStatus(messageBox, MessageBoxButton.OK);
SetImage(messageBox, MessageBoxImage.Warning);
SystemSounds.Asterisk.Play();
messageBox.ShowDialog();
}));
#else
Application.Current.Dispatcher.Invoke(() =>
{
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
SetButtonStatus(messageBox, MessageBoxButton.OK);
SetImage(messageBox, MessageBoxImage.Warning);
messageBox.ShowDialog();
});
#endif
return messageBox._messageBoxResult;
}
@@ -229,23 +203,14 @@ namespace HandyControl.Controls
public static MessageBoxResult Error(string messageBoxText, string caption = null)
{
MessageBox messageBox = null;
#if netle40
Application.Current.Dispatcher.Invoke(new Action(() =>
{
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
SetButtonStatus(messageBox, MessageBoxButton.OK);
SetImage(messageBox, MessageBoxImage.Error);
SystemSounds.Asterisk.Play();
messageBox.ShowDialog();
}));
#else
Application.Current.Dispatcher.Invoke(() =>
{
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
SetButtonStatus(messageBox, MessageBoxButton.OK);
SetImage(messageBox, MessageBoxImage.Error);
messageBox.ShowDialog();
});
#endif
return messageBox._messageBoxResult;
}
@@ -258,7 +223,6 @@ namespace HandyControl.Controls
public static MessageBoxResult Fatal(string messageBoxText, string caption = null)
{
MessageBox messageBox = null;
#if netle40
Application.Current.Dispatcher.Invoke(new Action(() =>
{
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
@@ -266,19 +230,9 @@ namespace HandyControl.Controls
messageBox.ShowImage = true;
messageBox.Image = ResourceHelper.GetResource<Geometry>(ResourceToken.FatalGeometry);
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(ResourceToken.PrimaryTextBrush);
SystemSounds.Asterisk.Play();
messageBox.ShowDialog();
}));
#else
Application.Current.Dispatcher.Invoke(() =>
{
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
SetButtonStatus(messageBox, MessageBoxButton.OK);
messageBox.ShowImage = true;
messageBox.Image = ResourceHelper.GetResource<Geometry>(ResourceToken.FatalGeometry);
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(ResourceToken.PrimaryTextBrush);
messageBox.ShowDialog();
});
#endif
return messageBox._messageBoxResult;
}
@@ -291,23 +245,14 @@ namespace HandyControl.Controls
public static MessageBoxResult Ask(string messageBoxText, string caption = null)
{
MessageBox messageBox = null;
#if netle40
Application.Current.Dispatcher.Invoke(new Action(() =>
{
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel);
SetButtonStatus(messageBox, MessageBoxButton.OKCancel);
SetImage(messageBox, MessageBoxImage.Question);
SystemSounds.Asterisk.Play();
messageBox.ShowDialog();
}));
#else
Application.Current.Dispatcher.Invoke(() =>
{
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel);
SetButtonStatus(messageBox, MessageBoxButton.OKCancel);
SetImage(messageBox, MessageBoxImage.Question);
messageBox.ShowDialog();
});
#endif
return messageBox._messageBoxResult;
}
@@ -320,7 +265,6 @@ namespace HandyControl.Controls
public static MessageBoxResult Show(MessageBoxInfo info)
{
MessageBox messageBox = null;
#if netle40
Application.Current.Dispatcher.Invoke(new Action(() =>
{
messageBox = CreateMessageBox(null, info.MessageBoxText, info.Caption, info.Button, MessageBoxImage.None, info.DefaultResult);
@@ -333,26 +277,13 @@ namespace HandyControl.Controls
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(info.IconBrushKey);
}
messageBox.Style = info.Style;
if (info.Style != null)
{
messageBox.Style = info.Style;
}
SystemSounds.Asterisk.Play();
messageBox.ShowDialog();
}));
#else
Application.Current.Dispatcher.Invoke(() =>
{
messageBox = CreateMessageBox(null, info.MessageBoxText, info.Caption, info.Button, MessageBoxImage.None, info.DefaultResult);
SetButtonStatus(messageBox, info.Button);
if (!string.IsNullOrEmpty(info.IconKey))
{
messageBox.ShowImage = true;
messageBox.Image = ResourceHelper.GetResource<Geometry>(info.IconKey);
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(info.IconBrushKey);
}
messageBox.Style = info.Style;
messageBox.ShowDialog();
});
#endif
return messageBox._messageBoxResult;
}
@@ -384,23 +315,14 @@ namespace HandyControl.Controls
public static MessageBoxResult Show(System.Windows.Window owner, string messageBoxText, string caption = null, MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.None)
{
MessageBox messageBox = null;
#if netle40
Application.Current.Dispatcher.Invoke(new Action(() =>
{
messageBox = CreateMessageBox(owner, messageBoxText, caption, button, icon, defaultResult);
SetButtonStatus(messageBox, button);
SetImage(messageBox, icon);
SystemSounds.Asterisk.Play();
messageBox.ShowDialog();
}));
#else
Application.Current.Dispatcher.Invoke(() =>
{
messageBox = CreateMessageBox(owner, messageBoxText, caption, button, icon, defaultResult);
SetButtonStatus(messageBox, button);
SetImage(messageBox, icon);
messageBox.ShowDialog();
});
#endif
return messageBox._messageBoxResult;
}
@@ -525,4 +447,4 @@ namespace HandyControl.Controls
|| value == MessageBoxResult.Yes;
}
}
}
}
@@ -9,7 +9,6 @@ using HandyControl.Tools.Extension;
using Microsoft.Windows.Shell;
#else
using System.Windows.Shell;
#endif
namespace HandyControl.Controls
@@ -3,7 +3,7 @@ using System.Windows.Input;
namespace HandyControl.Data
{
internal class KeyboardHookEventArgs : EventArgs
public class KeyboardHookEventArgs : EventArgs
{
public bool IsSystemKey { get; }
@@ -66,7 +66,7 @@ namespace HandyControl.Data
//
var values = frameDelayItem.Value;
_frameDelay = new int[FrameCount];
for (int i = 0; i < FrameCount; ++i)
for (var i = 0; i < FrameCount; ++i)
{
_frameDelay[i] = values[i * 4] + 256 * values[i * 4 + 1] + 256 * 256 * values[i * 4 + 2] + 256 * 256 * 256 * values[i * 4 + 3];
}
@@ -11,8 +11,12 @@
internal static object Double0Box = .0;
internal static object Double01Box = .1;
internal static object Double1Box = 1.0;
internal static object Double10Box = 10.0;
internal static object Double20Box = 20.0;
internal static object Double100Box = 100.0;
@@ -59,7 +59,7 @@ namespace HandyControl.Expression.Drawing
}
else
{
for (int i = list.Count - 1; i >= count; i--)
for (var i = list.Count - 1; i >= count; i--)
{
list.RemoveAt(i);
}
@@ -89,7 +89,7 @@ namespace HandyControl.Expression.Drawing
}
else
{
for (int i = list.Count; i < count; i++)
for (var i = list.Count; i < count; i++)
{
list.Add((factory == null) ? default(T) : factory());
}
@@ -2,6 +2,7 @@
using System.Windows;
using System.Windows.Media;
using System.Windows.Shapes;
using HandyControl.Data;
using HandyControl.Expression.Drawing;
using HandyControl.Expression.Media;
@@ -16,7 +17,7 @@ namespace HandyControl.Expression.Shapes
StretchProperty.OverrideMetadata(typeof(PrimitiveShape),
new DrawingPropertyMetadata(Stretch.Fill, DrawingPropertyMetadataOptions.AffectsRender));
StrokeThicknessProperty.OverrideMetadata(typeof(PrimitiveShape),
new DrawingPropertyMetadata(1.0, DrawingPropertyMetadataOptions.AffectsRender));
new DrawingPropertyMetadata(ValueBoxes.Double1Box, DrawingPropertyMetadataOptions.AffectsRender));
}
protected sealed override Geometry DefiningGeometry =>
@@ -17,8 +17,14 @@
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\IconSwitchElement.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\InfoElement.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\PanelElement.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\PasswordBoxMonitor.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\PasswordBoxAttach.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeTrack.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeThumb.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\TwoWayRangeBase.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\OpenLinkCommand.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\NameReferenceConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Extension\FrameworkElementExtension.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Extension\StringExtension.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\GlobalShortcut.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\StatusSwitchElement.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\TipElement.cs" />
@@ -86,9 +92,10 @@
<Compile Include="$(MSBuildThisFileDirectory)Controls\Rate\RateItem.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\SideMenu\SideMenu.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\SideMenu\SideMenuItem.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\CompareSlider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\CompareTrack.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\CompareSlider\CompareSlider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\CompareSlider\CompareTrack.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\PreviewSlider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeSlider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\StepBar\StepBar.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\StepBar\StepBarItem.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\TabControl\TabControl.cs" />
@@ -267,6 +274,10 @@
<Compile Include="$(MSBuildThisFileDirectory)Tools\Interop\WNDCLASS.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Interop\WpfSafeHandle.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\MouseDragElementBehaviorEx.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Pool\IPool!1.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Pool\SimplePool!1.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Pool\SynchronizedPool!1.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Queue\Deque!1.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\RegularJudgment.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\RegularPatterns.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\StyleSelector\RadioGroupItemStyleSelector.cs" />
@@ -333,6 +344,18 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\ColorPickerBaseStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\SliderBaseStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Col.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\GridSplitter.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -12,7 +12,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.5.5")]
[assembly: AssemblyVersion("2.0.0")]
#endif
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Controls")]
@@ -65,6 +65,7 @@
</ControlTemplate>
<Style x:Key="BadgeBaseStyle" TargetType="controls:Badge">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}" />
<Setter Property="BorderThickness" Value="1" />
@@ -25,6 +25,26 @@
</Setter>
</Style>
<Style x:Key="FocusVisualMargin0">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Opacity=".6" SnapsToDevicePixels="true" Stroke="{DynamicResource SecondaryBorderBrush}" StrokeThickness="2" StrokeDashArray="1 1" RadiusX="4" RadiusY="4"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="FocusVisualRadius0Margin0">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Opacity=".6" SnapsToDevicePixels="true" Stroke="{DynamicResource SecondaryBorderBrush}" StrokeThickness="2" StrokeDashArray="1 1"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="BaseStyle" TargetType="Control">
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="FontSize" Value="{StaticResource TextFontSize}"/>
@@ -17,7 +17,7 @@
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}">
<Path x:Name="PathMain" Width="{TemplateBinding controls:IconElement.Width}" Height="{TemplateBinding controls:IconElement.Height}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding controls:IconElement.Geometry}"/>
<ContentPresenter x:Name="ContentPresenterMain" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<ContentPresenter x:Name="ContentPresenterMain" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</StackPanel>
</Border>
</controls:SimplePanel>
@@ -134,6 +134,7 @@
</ControlTemplate>
<Style x:Key="ChatBubbleBaseStyle" TargetType="controls:ChatBubble">
<Setter Property="Focusable" Value="False"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Background" Value="{DynamicResource DarkPrimaryBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
@@ -0,0 +1,245 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:langs="clr-namespace:HandyControl.Properties.Langs"
xmlns:controls="clr-namespace:HandyControl.Controls"
xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../../Basic/Paths.xaml"/>
<ResourceDictionary Source="../../Basic/Converters.xaml"/>
<ResourceDictionary Source="../Slider.xaml"/>
<ResourceDictionary Source="../Button.xaml"/>
<ResourceDictionary Source="../ToggleButton.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="ColorPickerSliderRepeatButtonBaseStyle" TargetType="RepeatButton">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="ColorPickerSliderThumbTemplate" TargetType="Thumb">
<Border Width="13" Height="13" Background="White" CornerRadius="6.5"/>
</ControlTemplate>
<ControlTemplate x:Key="ColorPickerSliderHorizontal" TargetType="Slider">
<controls:SimplePanel>
<Border Margin="7,0" Background="{TemplateBinding Background}" MaxHeight="11" CornerRadius="2"/>
<Border Margin="7,0" Background="{TemplateBinding Foreground}" MaxHeight="11" CornerRadius="2">
<Border.OpacityMask>
<LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5">
<GradientStop Color="Transparent" Offset="1"/>
<GradientStop Color="White" Offset="0"/>
</LinearGradientBrush>
</Border.OpacityMask>
</Border>
<Track x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource ColorPickerSliderRepeatButtonBaseStyle}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource ColorPickerSliderRepeatButtonBaseStyle}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Focusable="False" Height="13" Width="13" OverridesDefaultStyle="True" Template="{StaticResource ColorPickerSliderThumbTemplate}" VerticalAlignment="Center">
<Thumb.Effect>
<DropShadowEffect ShadowDepth="0" Opacity=".6"/>
</Thumb.Effect>
</Thumb>
</Track.Thumb>
</Track>
</controls:SimplePanel>
</ControlTemplate>
<ControlTemplate x:Key="ColorPickerSliderVertical" TargetType="Slider">
<controls:SimplePanel>
<Border Margin="0,7" CornerRadius="2" MaxWidth="11" Background="{TemplateBinding Background}"/>
<Border Margin="0,7" CornerRadius="2" MaxWidth="11" Background="{TemplateBinding Foreground}">
<Border.OpacityMask>
<LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5">
<GradientStop Color="Transparent" Offset="1"/>
<GradientStop Color="White" Offset="0"/>
</LinearGradientBrush>
</Border.OpacityMask>
</Border>
<Track x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource ColorPickerSliderRepeatButtonBaseStyle}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource ColorPickerSliderRepeatButtonBaseStyle}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Focusable="False" Height="13" OverridesDefaultStyle="True" Template="{StaticResource ColorPickerSliderThumbTemplate}" VerticalAlignment="Top" Width="13">
<Thumb.Effect>
<DropShadowEffect ShadowDepth="0" Opacity=".6"/>
</Thumb.Effect>
</Thumb>
</Track.Thumb>
</Track>
</controls:SimplePanel>
</ControlTemplate>
<Style x:Key="ColorPickerSlider" BasedOn="{StaticResource BaseStyle}" TargetType="Slider">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Foreground" Value="Transparent"/>
<Setter Property="Template" Value="{StaticResource ColorPickerSliderHorizontal}"/>
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Template" Value="{StaticResource ColorPickerSliderVertical}"/>
</Trigger>
</Style.Triggers>
</Style>
<LinearGradientBrush x:Key="ColorPickerRainbowBrush">
<GradientStop Color="#ff0000"/>
<GradientStop Color="#ff00ff" Offset="0.167"/>
<GradientStop Color="#0000ff" Offset="0.334"/>
<GradientStop Color="#00ffff" Offset="0.501"/>
<GradientStop Color="#00ff00" Offset="0.668"/>
<GradientStop Color="#ffff00" Offset="0.835"/>
<GradientStop Color="#ff0000" Offset="1"/>
</LinearGradientBrush>
<DrawingBrush x:Key="ColorPickerOpacityBrush" Viewport="0,0,12,11" ViewportUnits="Absolute" Stretch="None" TileMode="Tile">
<DrawingBrush.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="#d0cec7">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,6,5" />
<RectangleGeometry Rect="6,6,6,5" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#e7e7e2">
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,5,12,1" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
<Style x:Key="ColorPickerBaseStyle" TargetType="controls:ColorPicker">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Width" Value="230"/>
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="UseLayoutRounding" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:ColorPicker">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="122"/>
<RowDefinition Height="110"/>
<RowDefinition Height="62"/>
<RowDefinition Height="62"/>
</Grid.RowDefinitions>
<Border BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Grid.RowSpan="4" Background="{TemplateBinding Background}"/>
<controls:SimplePanel Margin="1" Grid.Row="0">
<Border Background="{TemplateBinding BackColor}"/>
<Border>
<Border.Background>
<LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5">
<GradientStop Color="White" Offset="1"/>
<GradientStop Color="#80ffffff" Offset=".5"/>
<GradientStop Color="#00ffffff"/>
</LinearGradientBrush>
</Border.Background>
</Border>
<Border>
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset="1"/>
<GradientStop Color="#80000000" Offset=".5"/>
<GradientStop Color="#00000000"/>
</LinearGradientBrush>
</Border.Background>
</Border>
</controls:SimplePanel>
<Border Name="PART_BorderColor" Grid.Row="0" CornerRadius="2,2,0,0" ClipToBounds="True">
<Canvas Margin="-6">
<Border Name="PART_BorderPicker" Background="Transparent" Height="12" CornerRadius="6" Width="12" BorderThickness="1" BorderBrush="White">
<Border.Effect>
<DropShadowEffect ShadowDepth="0" Opacity=".4"/>
</Border.Effect>
</Border>
</Canvas>
</Border>
<Border Grid.Row="0" Background="Transparent" Name="PART_BorderDrag"/>
<Grid Margin="16,16,10,0" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="28"/>
</Grid.ColumnDefinitions>
<ToggleButton Name="PART_ButtonDropper" Width="16" Height="16" Margin="0,0,10,0" Style="{StaticResource ToggleButtonCustom}" controls:StatusSwitchElement.HideUncheckedElement="True">
<Path Data="{StaticResource DropperGeometry}" Fill="{DynamicResource PrimaryTextBrush}"/>
<controls:StatusSwitchElement.CheckedElement>
<Path Data="{StaticResource DropperGeometry}" Fill="{DynamicResource DarkPrimaryBrush}"/>
</controls:StatusSwitchElement.CheckedElement>
</ToggleButton>
<Border Grid.Row="0" Grid.Column="1" Width="32" Height="32" CornerRadius="16" Background="{StaticResource ColorPickerOpacityBrush}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"/>
<Border Grid.Row="0" Grid.Column="1" Width="32" Height="32" CornerRadius="16" Background="{TemplateBinding SelectedBrush}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"/>
<Slider Name="PART_SliderColor" LargeChange="0.01" SmallChange="0.01" Grid.ColumnSpan="2" Value="6" Maximum="6" Background="{StaticResource ColorPickerRainbowBrush}" Margin="2,1,0,0" Grid.Row="0" Grid.Column="2" VerticalAlignment="Top" Style="{StaticResource ColorPickerSlider}" IsMoveToPointEnabled="True"/>
<Slider Name="PART_SliderOpacity" Grid.ColumnSpan="2" IsSnapToTickEnabled="True" Value="{Binding ChannelA,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" Maximum="255" SmallChange="1" Foreground="{TemplateBinding SelectedBrushWithoutOpacity}" Background="{StaticResource ColorPickerOpacityBrush}" Margin="2,0,0,0" Grid.Row="0" Grid.Column="2" VerticalAlignment="Bottom" Style="{StaticResource ColorPickerSlider}" IsMoveToPointEnabled="True"/>
<StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="0,14,0,0" VerticalAlignment="Top" Visibility="{Binding ShowList[0],RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}">
<TextBox Padding="0" HorizontalContentAlignment="Center" Width="176" Text="{Binding SelectedBrush,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay,Converter={StaticResource Color2HexStrConverter},UpdateSourceTrigger=LostFocus}" FontSize="10" MaxLength="10" Height="24" />
<TextBlock Foreground="{DynamicResource ThirdlyTextBrush}" Margin="0,6,0,0" FontSize="10" Text="HEX" HorizontalAlignment="Center"/>
</StackPanel>
<UniformGrid Name="PART_PanelRgb" Visibility="{Binding ShowList[1],RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" Rows="1" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="-2,14,-2,0" VerticalAlignment="Top">
<StackPanel Margin="2,0">
<controls:NumericUpDown HorizontalContentAlignment="Center" Padding="2,0" Tag="R" Value="{Binding ChannelR,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" ShowUpDownButton="False" Maximum="255" Minimum="0" FontSize="10" Height="24" />
<TextBlock Foreground="{DynamicResource ThirdlyTextBrush}" Margin="0,6,0,0" FontSize="10" Text="R" HorizontalAlignment="Center"/>
</StackPanel>
<StackPanel Margin="2,0">
<controls:NumericUpDown HorizontalContentAlignment="Center" Padding="0" Tag="G" Value="{Binding ChannelG,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" ShowUpDownButton="False" Maximum="255" Minimum="0" FontSize="10" Height="24" />
<TextBlock Foreground="{DynamicResource ThirdlyTextBrush}" Margin="0,6,0,0" FontSize="10" Text="G" HorizontalAlignment="Center"/>
</StackPanel>
<StackPanel Margin="2,0">
<controls:NumericUpDown HorizontalContentAlignment="Center" Padding="0" Tag="B" Value="{Binding ChannelB,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" ShowUpDownButton="False" Maximum="255" Minimum="0" FontSize="10" Height="24" />
<TextBlock Foreground="{DynamicResource ThirdlyTextBrush}" Margin="0,6,0,0" FontSize="10" Text="B" HorizontalAlignment="Center"/>
</StackPanel>
<StackPanel Margin="2,0">
<controls:NumericUpDown HorizontalContentAlignment="Center" Padding="0" Value="{Binding ChannelA,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ShowUpDownButton="False" Maximum="255" Minimum="0" FontSize="10" Height="24" />
<TextBlock Foreground="{DynamicResource ThirdlyTextBrush}" Margin="0,6,0,0" FontSize="10" Text="A" HorizontalAlignment="Center"/>
</StackPanel>
</UniformGrid>
<Button Command="interactivity:ControlCommands.Switch" Padding="6" FontSize="8" BorderThickness="0" HorizontalAlignment="Right" Height="24" Width="20" Grid.Column="3" Grid.Row="1">
<Button.Content>
<Path Fill="#323534" Style="{StaticResource UpDownPathStyle}"/>
</Button.Content>
</Button>
</Grid>
<Border Grid.Row="2" BorderThickness="0,1,0,0" BorderBrush="{DynamicResource BorderBrush}">
<WrapPanel Name="PART_PanelColor" Margin="6" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Row="3" BorderThickness="0,1,0,0" BorderBrush="{DynamicResource BorderBrush}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Command="interactivity:ControlCommands.Cancel" Content="{x:Static langs:Lang.Cancel}" Width="80" Margin="0,0,16,0"/>
<Button Command="interactivity:ControlCommands.Confirm" Content="{x:Static langs:Lang.Confirm}" Width="80" Style="{StaticResource ButtonPrimary}"/>
</StackPanel>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
@@ -3,6 +3,7 @@
xmlns:controls="clr-namespace:HandyControl.Controls">
<Style x:Key="CoverFlowBaseStyle" TargetType="controls:CoverFlow">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:CoverFlow">
@@ -3,6 +3,7 @@
xmlns:controls="clr-namespace:HandyControl.Controls">
<Style x:Key="CoverViewItemBaseStyle" TargetType="controls:CoverViewItem">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:CoverViewItem">
@@ -15,6 +16,7 @@
</Style>
<Style x:Key="CoverViewContentBaseStyle" TargetType="controls:CoverViewContent">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
@@ -52,6 +54,7 @@
</Style>
<Style x:Key="CoverViewBaseStyle" TargetType="controls:CoverView">
<Setter Property="Focusable" Value="False"/>
<Setter Property="ItemContainerStyle" Value="{StaticResource CoverViewItemBaseStyle}"/>
<Setter Property="CoverViewContentStyle" Value="{StaticResource CoverViewContentBaseStyle}"/>
<Setter Property="ItemMargin" Value="8"/>
@@ -3,6 +3,7 @@
xmlns:controls="clr-namespace:HandyControl.Controls">
<Style x:Key="DialogBaseStyle" TargetType="controls:Dialog">
<Setter Property="Focusable" Value="False"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
@@ -15,6 +15,19 @@
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="Padding" Value="16"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="-2" Opacity=".6" SnapsToDevicePixels="true" Stroke="{DynamicResource SecondaryBorderBrush}" StrokeThickness="2" StrokeDashArray="1 1" RadiusX="25" RadiusY="25"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}"/>
@@ -3,6 +3,7 @@
xmlns:controls="clr-namespace:HandyControl.Controls">
<Style x:Key="GravatarBaseStyle" TargetType="controls:Gravatar">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Width" Value="72"/>
<Setter Property="Height" Value="72"/>
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
@@ -2,12 +2,15 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="BaseStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!--默认ListBoxItem样式-->
<Style x:Key="ListBoxItemBaseStyle" TargetType="ListBoxItem">
<Style x:Key="ListBoxItemBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="ListBoxItem">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualRadius0Margin0}"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Padding" Value="10,0"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="MinHeight" Value="32"/>
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType=ItemsControl}}"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
@@ -3,6 +3,7 @@
xmlns:controls="clr-namespace:HandyControl.Controls">
<Style x:Key="LoadingBaseStyle" TargetType="controls:LoadingBase">
<Setter Property="Focusable" Value="False"/>
<Setter Property="DotDiameter" Value="10"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/>
</Style>
@@ -65,7 +65,7 @@
<ScrollViewer Margin="-1,1" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Grid.Row="1" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="controls:PasswordBoxMonitor.PasswordLength" Value="0">
<Trigger Property="controls:PasswordBoxAttach.PasswordLength" Value="0">
<Setter Property="Visibility" TargetName="placeholder" Value="Visible"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
@@ -97,7 +97,7 @@
<ScrollViewer Margin="-1,1" Padding="{TemplateBinding Padding}" Grid.Column="1" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="controls:PasswordBoxMonitor.PasswordLength" Value="0">
<Trigger Property="controls:PasswordBoxAttach.PasswordLength" Value="0">
<Setter Property="Visibility" TargetName="placeholder" Value="Visible"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
@@ -119,7 +119,7 @@
<Setter Property="Padding" Value="7,6"/>
<Setter Property="controls:InfoElement.Symbol" Value="●"/>
<Setter Property="controls:InfoElement.ContentHeight" Value="30.0"/>
<Setter Property="controls:PasswordBoxMonitor.IsMonitoring" Value="True"/>
<Setter Property="controls:PasswordBoxAttach.IsMonitoring" Value="True"/>
<Setter Property="Template" Value="{StaticResource PasswordBoxExtendTopTemplate}"/>
<Style.Triggers>
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
@@ -146,7 +146,7 @@
<ScrollViewer Padding="{TemplateBinding Padding}" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
</controls:SimplePanel>
<ControlTemplate.Triggers>
<Trigger Property="controls:PasswordBoxMonitor.PasswordLength" Value="0">
<Trigger Property="controls:PasswordBoxAttach.PasswordLength" Value="0">
<Setter Property="Visibility" TargetName="placeholder" Value="Visible"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
@@ -296,7 +296,7 @@
<Setter Property="Padding" Value="{StaticResource DefaultInputPadding}"/>
<Setter Property="controls:InfoElement.Symbol" Value="●"/>
<Setter Property="controls:InfoElement.ContentHeight" Value="{StaticResource DefaultControlHeight}"/>
<Setter Property="controls:PasswordBoxMonitor.IsMonitoring" Value="True"/>
<Setter Property="controls:PasswordBoxAttach.IsMonitoring" Value="True"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="Template" Value="{StaticResource PasswordBoxPlusTopTemplate}"/>
<Style.Triggers>
@@ -127,7 +127,7 @@
<Border Name="BorderHighlight" BorderThickness="3,0,0,0" BorderBrush="Transparent">
<StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}">
<Path x:Name="PathMain" Height="{Binding Path=(controls:IconElement.Height),RelativeSource={RelativeSource TemplatedParent}}" Width="{Binding Path=(controls:IconElement.Width),RelativeSource={RelativeSource TemplatedParent}}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding controls:IconElement.Geometry}"/>
<ContentPresenter x:Name="ContentPresenterMain" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<ContentPresenter x:Name="ContentPresenterMain" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</StackPanel>
</Border>
</Border>
@@ -174,7 +174,7 @@
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Border x:Name="BorderRoot" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<ContentPresenter x:Name="contentPresenter" TextElement.Foreground="{TemplateBinding Foreground}" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
<ContentPresenter x:Name="contentPresenter" TextElement.Foreground="{TemplateBinding Foreground}" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
@@ -5,9 +5,11 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../../Basic/Geometries.xaml"/>
<ResourceDictionary Source="../../Basic/Converters.xaml"/>
<ResourceDictionary Source="BaseStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="RateRateItemBaseStyle" TargetType="controls:RateItem">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Margin" Value="{Binding ItemMargin,RelativeSource={RelativeSource AncestorType=controls:Rate}}"/>
<Setter Property="Width" Value="{Binding ItemWidth,RelativeSource={RelativeSource AncestorType=controls:Rate}}"/>
<Setter Property="Height" Value="{Binding ItemHeight,RelativeSource={RelativeSource AncestorType=controls:Rate}}"/>
@@ -62,6 +64,7 @@
</Style>
<Style x:Key="RateBaseStyle" TargetType="controls:Rate">
<Setter Property="Focusable" Value="False"/>
<Setter Property="ItemMargin" Value="5,0"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Top"/>
@@ -2,7 +2,11 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls">
<Style x:Key="ShieldBaseStyle" TargetType="controls:Shield">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Base/BaseStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="ShieldBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="controls:Shield">
<Setter Property="Height" Value="20"/>
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
<Setter Property="controls:BorderElement.CornerRadius" Value="3"/>
@@ -7,6 +7,7 @@
</ResourceDictionary.MergedDictionaries>
<Style x:Key="SideMenuItemBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="controls:SideMenuItem">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualRadius0Margin0}"/>
<Setter Property="Role" Value="Item"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
@@ -87,6 +88,7 @@
</Style>
<Style x:Key="SideMenuItemHeaderBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="controls:SideMenuItem">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualRadius0Margin0}"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="ItemContainerStyle" Value="{StaticResource SideMenuItemBaseStyle}"/>
@@ -0,0 +1,925 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="BaseStyle.xaml"/>
<ResourceDictionary Source="../../Basic/Geometries.xaml"/>
<ResourceDictionary Source="../../Basic/Effects.xaml"/>
<ResourceDictionary Source="../Label.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!--CompareSlider-->
<Style x:Key="CompareSliderRepeatButtonTransparent" TargetType="RepeatButton">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<ContentPresenter Content="{TemplateBinding Content}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="CompareSliderThumbHorizontal" TargetType="Thumb">
<ControlTemplate.Resources>
<Storyboard x:Key="Storyboard1">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)" Storyboard.TargetName="PathLeft">
<EasingDoubleKeyFrame KeyTime="0" Value="-2"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)" Storyboard.TargetName="PathRight">
<EasingDoubleKeyFrame KeyTime="0" Value="2"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="Storyboard2">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)" Storyboard.TargetName="PathLeft">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)" Storyboard.TargetName="PathRight">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<controls:SimplePanel>
<Border Width="1" HorizontalAlignment="Center">
<Border.Background>
<DrawingBrush RenderOptions.CachingHint="Cache" Viewport="0,0,1,8" ViewportUnits="Absolute" Stretch="None" TileMode="Tile">
<DrawingBrush.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="{DynamicResource BorderBrush}">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,1,4" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Border.Background>
</Border>
<Border x:Name="grip" Width="30" Height="30" CornerRadius="15" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Background="White">
<controls:SimplePanel Width="30" Height="30" Margin="-1,-1,0,0">
<Path x:Name="PathLeft" Data="{StaticResource LeftGeometry}" StrokeThickness="1" Stroke="{DynamicResource PrimaryBrush}" Margin="6,8" HorizontalAlignment="Left" Stretch="Uniform" Width="12" Height="12" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<TransformGroup>
<TranslateTransform/>
</TransformGroup>
</Path.RenderTransform>
</Path>
<Path x:Name="PathRight" Data="{StaticResource RightGeometry}" StrokeThickness="1" Stroke="{DynamicResource PrimaryBrush}" Margin="6,8" HorizontalAlignment="Right" Stretch="Uniform" Width="12" Height="12" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<TransformGroup>
<TranslateTransform/>
</TransformGroup>
</Path.RenderTransform>
</Path>
</controls:SimplePanel>
</Border>
</controls:SimplePanel>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="grip" Value="{DynamicResource PrimaryBrush}"/>
<Setter Property="Stroke" TargetName="PathLeft" Value="White"/>
<Setter Property="Stroke" TargetName="PathRight" Value="White"/>
</Trigger>
<Trigger Property="IsDragging" Value="true">
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard2}"/>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="CompareSliderHorizontal" TargetType="controls:CompareSlider">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<controls:CompareTrack Margin="-14,0,-15,0" x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Margin="14,0,-15,0" Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border HorizontalAlignment="Left" Width="{TemplateBinding Width}">
<ContentPresenter Content="{TemplateBinding TargetContent}"/>
</Border>
</RepeatButton.Content>
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Margin="-15,0,15,0" Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border HorizontalAlignment="Right" Width="{TemplateBinding ActualWidth}">
<ContentPresenter Content="{TemplateBinding SourceContent}"/>
</Border>
</RepeatButton.Content>
</RepeatButton>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Focusable="False" OverridesDefaultStyle="True" Template="{StaticResource CompareSliderThumbHorizontal}" Width="30" Margin="0,0,0,0"/>
</Track.Thumb>
</controls:CompareTrack>
</Border>
</ControlTemplate>
<ControlTemplate x:Key="CompareSliderThumbVertical" TargetType="Thumb">
<ControlTemplate.Resources>
<Storyboard x:Key="Storyboard1">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)" Storyboard.TargetName="PathUp">
<EasingDoubleKeyFrame KeyTime="0" Value="-2"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)" Storyboard.TargetName="PathDown">
<EasingDoubleKeyFrame KeyTime="0" Value="2"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="Storyboard2">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)" Storyboard.TargetName="PathUp">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)" Storyboard.TargetName="PathDown">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<controls:SimplePanel>
<Border Height="1" VerticalAlignment="Center">
<Border.Background>
<DrawingBrush RenderOptions.CachingHint="Cache" Viewport="0,0,8,1" ViewportUnits="Absolute" Stretch="None" TileMode="Tile">
<DrawingBrush.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="{DynamicResource BorderBrush}">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,4,1" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Border.Background>
</Border>
<Border x:Name="grip" Width="30" Height="30" CornerRadius="15" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Background="White">
<controls:SimplePanel Width="30" Height="30" Margin="-1,-1,0,0">
<Path x:Name="PathUp" Data="{StaticResource UpGeometry}" StrokeThickness="1" Stroke="{DynamicResource PrimaryBrush}" Margin="9,6" VerticalAlignment="Top" Stretch="Uniform" Width="12" Height="12" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<TransformGroup>
<TranslateTransform/>
</TransformGroup>
</Path.RenderTransform>
</Path>
<Path x:Name="PathDown" Data="{StaticResource DownGeometry}" StrokeThickness="1" Stroke="{DynamicResource PrimaryBrush}" Margin="9,6" VerticalAlignment="Bottom" Stretch="Uniform" Width="12" Height="12" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<TransformGroup>
<TranslateTransform/>
</TransformGroup>
</Path.RenderTransform>
</Path>
</controls:SimplePanel>
</Border>
</controls:SimplePanel>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true" SourceName="grip">
<Setter Property="Background" TargetName="grip" Value="{DynamicResource PrimaryBrush}"/>
<Setter Property="Stroke" TargetName="PathUp" Value="White"/>
<Setter Property="Stroke" TargetName="PathDown" Value="White"/>
</Trigger>
<Trigger Property="IsDragging" Value="true">
<Setter Property="Background" TargetName="grip" Value="{DynamicResource PrimaryBrush}"/>
<Setter Property="Stroke" TargetName="PathUp" Value="White"/>
<Setter Property="Stroke" TargetName="PathDown" Value="White"/>
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard2}"/>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="CompareSliderVertical" TargetType="controls:CompareSlider">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<controls:CompareTrack Margin="0,-14,0,-15" x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Margin="0,-15,0,15" Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border VerticalAlignment="Bottom" Height="{TemplateBinding Height}">
<ContentPresenter Content="{TemplateBinding TargetContent}"/>
</Border>
</RepeatButton.Content>
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Margin="0,14,0,-15" Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border VerticalAlignment="Top" Height="{TemplateBinding Height}">
<ContentPresenter Content="{TemplateBinding SourceContent}"/>
</Border>
</RepeatButton.Content>
</RepeatButton>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Focusable="False" Height="30" OverridesDefaultStyle="True" Template="{StaticResource CompareSliderThumbVertical}" VerticalAlignment="Top"/>
</Track.Thumb>
</controls:CompareTrack>
</Border>
</ControlTemplate>
<Style x:Key="CompareSliderBaseStyle" TargetType="controls:CompareSlider">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="MinWidth" Value="30"/>
<Setter Property="MinHeight" Value="30"/>
<Setter Property="Template" Value="{StaticResource CompareSliderHorizontal}"/>
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Template" Value="{StaticResource CompareSliderVertical}"/>
</Trigger>
</Style.Triggers>
</Style>
<!--PreviewSlider-->
<Style x:Key="PreviewSliderRepeatButtonStyle" TargetType="RepeatButton">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border Background="Transparent" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
<Rectangle Fill="{TemplateBinding Background}" Height="2"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="PreviewSliderThumbHorizontal" TargetType="Thumb">
<Border Effect="{StaticResource EffectShadow1}" Name="BorderDot" BorderThickness="0" BorderBrush="{DynamicResource PrimaryBrush}" Width="18" Height="18" Background="White" CornerRadius="9"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource EffectShadow2}"/>
</Trigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="2" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="0" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="PreviewSliderHorizontal" TargetType="controls:PreviewSlider">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
</Grid.RowDefinitions>
<ContentControl x:Name="PART_ContentBorder" HorizontalAlignment="Left" VerticalAlignment="Bottom" Visibility="Hidden" Content="{TemplateBinding PreviewContent}" Margin="9,0,9,6"/>
<Border x:Name="TrackBackground" Background="{TemplateBinding Background}" Height="2" Grid.Row="1" VerticalAlignment="center" Margin="9,0"/>
<Track Margin="9,0" x:Name="PART_Track" Grid.Row="1">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Background="{DynamicResource PrimaryBrush}" Style="{StaticResource PreviewSliderRepeatButtonStyle}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource PreviewSliderRepeatButtonStyle}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb Margin="-9,0" x:Name="Thumb" Focusable="False" Height="18" OverridesDefaultStyle="True" Template="{StaticResource PreviewSliderThumbHorizontal}" VerticalAlignment="Center" Width="18"/>
</Track.Thumb>
</Track>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Visibility" Value="Visible" TargetName="PART_ContentBorder"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style x:Key="PreviewSliderBaseStyle" TargetType="controls:PreviewSlider">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
<Setter Property="IsMoveToPointEnabled" Value="True"/>
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Template" Value="{StaticResource PreviewSliderHorizontal}"/>
</Style>
<!--Common-->
<Style x:Key="SliderRepeatButtonHorizontalStyle" TargetType="RepeatButton">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border Background="Transparent" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
<Rectangle StrokeThickness="0" Fill="{TemplateBinding Background}" Height="2"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SliderRepeatButtonVerticalStyle" TargetType="RepeatButton">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border Background="Transparent" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
<Rectangle StrokeThickness="0" Fill="{TemplateBinding Background}" Width="2"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="SliderThumb" TargetType="Thumb">
<Border Effect="{StaticResource EffectShadow1}" Name="BorderDot" BorderThickness="0" BorderBrush="{DynamicResource PrimaryBrush}" Width="18" Height="18" Background="White" CornerRadius="9"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource EffectShadow2}"/>
</Trigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="2" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="0" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="TipSliderThumbHorizontalTop" TargetType="Thumb">
<controls:InternalCanvas>
<Label Name="LabelValue" Opacity="0" Canvas.Bottom="28" Style="{StaticResource LabelPrimary}" Content="{Binding Value,RelativeSource={RelativeSource AncestorType=Slider}}"/>
<Border Canvas.Bottom="0" Effect="{StaticResource EffectShadow1}" Name="BorderDot" BorderThickness="0" BorderBrush="{DynamicResource PrimaryBrush}" Width="18" Height="18" Background="White" CornerRadius="9"/>
</controls:InternalCanvas>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource EffectShadow2}" TargetName="BorderDot"/>
<Setter Property="Opacity" Value="1" TargetName="LabelValue"/>
</Trigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="2" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="0" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="TipSliderThumbHorizontalBottom" TargetType="Thumb">
<controls:InternalCanvas>
<Label Name="LabelValue" Opacity="0" Canvas.Top="28" Style="{StaticResource LabelPrimary}" Content="{Binding Value,RelativeSource={RelativeSource AncestorType=Slider}}"/>
<Border Canvas.Bottom="0" Effect="{StaticResource EffectShadow1}" Name="BorderDot" BorderThickness="0" BorderBrush="{DynamicResource PrimaryBrush}" Width="18" Height="18" Background="White" CornerRadius="9"/>
</controls:InternalCanvas>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource EffectShadow2}" TargetName="BorderDot"/>
<Setter Property="Opacity" Value="1" TargetName="LabelValue"/>
</Trigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="2" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="0" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="TipSliderThumbVerticalLeft" TargetType="Thumb">
<controls:InternalCanvas Orientation="Vertical">
<Label Name="LabelValue" Opacity="0" Canvas.Right="28" Style="{StaticResource LabelPrimary}" Content="{Binding Value,RelativeSource={RelativeSource AncestorType=Slider}}"/>
<Border Canvas.Right="0" Effect="{StaticResource EffectShadow1}" Name="BorderDot" BorderThickness="0" BorderBrush="{DynamicResource PrimaryBrush}" Width="18" Height="18" Background="White" CornerRadius="9"/>
</controls:InternalCanvas>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource EffectShadow2}" TargetName="BorderDot"/>
<Setter Property="Opacity" Value="1" TargetName="LabelValue"/>
</Trigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="2" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="0" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="TipSliderThumbVerticalRight" TargetType="Thumb">
<controls:InternalCanvas Orientation="Vertical">
<Label Name="LabelValue" Opacity="0" Canvas.Left="28" Style="{StaticResource LabelPrimary}" Content="{Binding Value,RelativeSource={RelativeSource AncestorType=Slider}}"/>
<Border Canvas.Right="0" Effect="{StaticResource EffectShadow1}" Name="BorderDot" BorderThickness="0" BorderBrush="{DynamicResource PrimaryBrush}" Width="18" Height="18" Background="White" CornerRadius="9"/>
</controls:InternalCanvas>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource EffectShadow2}" TargetName="BorderDot"/>
<Setter Property="Opacity" Value="1" TargetName="LabelValue"/>
</Trigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="2" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="0" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="SliderHorizontal" TargetType="Slider">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TickBar x:Name="TopTick" Fill="{TemplateBinding Foreground}" Height="4" Margin="0,0,0,2" Placement="Top" Grid.Row="0" Visibility="Collapsed"/>
<TickBar x:Name="BottomTick" Fill="{TemplateBinding Foreground}" Height="4" Margin="0,2,0,0" Placement="Bottom" Grid.Row="2" Visibility="Collapsed"/>
<Border x:Name="TrackBackground" Background="{TemplateBinding Background}" Grid.Row="1" Height="2" VerticalAlignment="center" Margin="9,0">
<Canvas x:Name="Canvas_SelectionRange" Visibility="Hidden">
<Rectangle x:Name="PART_SelectionRange" Fill="{DynamicResource AccentBrush}" Height="2"/>
</Canvas>
</Border>
<Track Margin="9,0" x:Name="PART_Track" Grid.Row="1">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Background="{DynamicResource PrimaryBrush}" Style="{StaticResource SliderRepeatButtonHorizontalStyle}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource SliderRepeatButtonHorizontalStyle}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb ClipToBounds="False" Width="18" Margin="-9,0" Height="18" x:Name="Thumb" Focusable="False" OverridesDefaultStyle="True" Template="{StaticResource SliderThumb}" VerticalAlignment="Center"/>
</Track.Thumb>
</Track>
</Grid>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="controls:TipElement.Placement" Value="TopLeft"/>
<Condition Property="controls:TipElement.Visibility" Value="Visible"/>
</MultiTrigger.Conditions>
<Setter Property="Template" TargetName="Thumb" Value="{StaticResource TipSliderThumbHorizontalTop}"/>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="controls:TipElement.Placement" Value="BottomRight"/>
<Condition Property="controls:TipElement.Visibility" Value="Visible"/>
</MultiTrigger.Conditions>
<Setter Property="Template" TargetName="Thumb" Value="{StaticResource TipSliderThumbHorizontalBottom}"/>
</MultiTrigger>
<Trigger Property="TickPlacement" Value="TopLeft">
<Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
</Trigger>
<Trigger Property="TickPlacement" Value="BottomRight">
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
</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="Canvas_SelectionRange" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="SliderVertical" TargetType="Slider">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition MinWidth="{TemplateBinding MinWidth}" Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TickBar x:Name="TopTick" Grid.Column="0" Fill="{TemplateBinding Foreground}" Margin="0,0,2,0" Placement="Left" Visibility="Collapsed" Width="4"/>
<TickBar x:Name="BottomTick" Grid.Column="2" Fill="{TemplateBinding Foreground}" Margin="2,0,0,0" Placement="Right" Visibility="Collapsed" Width="4"/>
<Border x:Name="TrackBackground" Background="{TemplateBinding Background}" Grid.Column="1" HorizontalAlignment="center" Margin="0,9" Width="2">
<Canvas x:Name="Canvas_SelectionRange" Visibility="Hidden">
<Rectangle x:Name="PART_SelectionRange" Fill="{DynamicResource AccentBrush}" Width="2"/>
</Canvas>
</Border>
<Track Margin="0,9" x:Name="PART_Track" Grid.Column="1">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Background="{DynamicResource PrimaryBrush}" Style="{StaticResource SliderRepeatButtonVerticalStyle}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource SliderRepeatButtonVerticalStyle}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb Margin="0,-9" x:Name="Thumb" Focusable="False" Height="18" OverridesDefaultStyle="True" Template="{StaticResource SliderThumb}" HorizontalAlignment="Center" Width="18"/>
</Track.Thumb>
</Track>
</Grid>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="controls:TipElement.Placement" Value="TopLeft"/>
<Condition Property="controls:TipElement.Visibility" Value="Visible"/>
</MultiTrigger.Conditions>
<Setter Property="Template" TargetName="Thumb" Value="{StaticResource TipSliderThumbVerticalLeft}"/>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="controls:TipElement.Placement" Value="BottomRight"/>
<Condition Property="controls:TipElement.Visibility" Value="Visible"/>
</MultiTrigger.Conditions>
<Setter Property="Template" TargetName="Thumb" Value="{StaticResource TipSliderThumbVerticalRight}"/>
</MultiTrigger>
<Trigger Property="TickPlacement" Value="TopLeft">
<Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
</Trigger>
<Trigger Property="TickPlacement" Value="BottomRight">
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
</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="Canvas_SelectionRange" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style x:Key="SliderBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="Slider">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource DarkPrimaryBrush}"/>
<Setter Property="Template" Value="{StaticResource SliderHorizontal}"/>
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Template" Value="{StaticResource SliderVertical}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value=".4"/>
</Trigger>
</Style.Triggers>
</Style>
<!--RangeSlider-->
<ControlTemplate x:Key="RangeSliderThumb" TargetType="controls:RangeThumb">
<Border Effect="{StaticResource EffectShadow1}" Name="BorderDot" BorderThickness="0" BorderBrush="{DynamicResource PrimaryBrush}" Width="18" Height="18" Background="White" CornerRadius="9"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource EffectShadow2}"/>
</Trigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="2" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="0" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="TipRangeSliderThumbHorizontalTop" TargetType="controls:RangeThumb">
<controls:InternalCanvas>
<Label Name="LabelValue" Opacity="0" Canvas.Bottom="28" Style="{StaticResource LabelPrimary}" Content="{TemplateBinding Content}"/>
<Border Canvas.Bottom="0" Effect="{StaticResource EffectShadow1}" Name="BorderDot" BorderThickness="0" BorderBrush="{DynamicResource PrimaryBrush}" Width="18" Height="18" Background="White" CornerRadius="9"/>
</controls:InternalCanvas>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource EffectShadow2}" TargetName="BorderDot"/>
<Setter Property="Opacity" Value="1" TargetName="LabelValue"/>
</Trigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="2" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="0" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="TipRangeSliderThumbHorizontalBottom" TargetType="controls:RangeThumb">
<controls:InternalCanvas>
<Label Name="LabelValue" Opacity="0" Canvas.Top="28" Style="{StaticResource LabelPrimary}" Content="{TemplateBinding Content}"/>
<Border Canvas.Bottom="0" Effect="{StaticResource EffectShadow1}" Name="BorderDot" BorderThickness="0" BorderBrush="{DynamicResource PrimaryBrush}" Width="18" Height="18" Background="White" CornerRadius="9"/>
</controls:InternalCanvas>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource EffectShadow2}" TargetName="BorderDot"/>
<Setter Property="Opacity" Value="1" TargetName="LabelValue"/>
</Trigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="2" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="0" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="TipRangeSliderThumbVerticalLeft" TargetType="controls:RangeThumb">
<controls:InternalCanvas Orientation="Vertical">
<Label Name="LabelValue" Opacity="0" Canvas.Right="28" Style="{StaticResource LabelPrimary}" Content="{TemplateBinding Content}"/>
<Border Canvas.Right="0" Effect="{StaticResource EffectShadow1}" Name="BorderDot" BorderThickness="0" BorderBrush="{DynamicResource PrimaryBrush}" Width="18" Height="18" Background="White" CornerRadius="9"/>
</controls:InternalCanvas>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource EffectShadow2}" TargetName="BorderDot"/>
<Setter Property="Opacity" Value="1" TargetName="LabelValue"/>
</Trigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="2" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="0" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="TipRangeSliderThumbVerticalRight" TargetType="controls:RangeThumb">
<controls:InternalCanvas Orientation="Vertical">
<Label Name="LabelValue" Opacity="0" Canvas.Left="28" Style="{StaticResource LabelPrimary}" Content="{TemplateBinding Content}"/>
<Border Canvas.Right="0" Effect="{StaticResource EffectShadow1}" Name="BorderDot" BorderThickness="0" BorderBrush="{DynamicResource PrimaryBrush}" Width="18" Height="18" Background="White" CornerRadius="9"/>
</controls:InternalCanvas>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource EffectShadow2}" TargetName="BorderDot"/>
<Setter Property="Opacity" Value="1" TargetName="LabelValue"/>
</Trigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="2" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="0" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="RangeSliderHorizontal" TargetType="controls:RangeSlider">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TickBar x:Name="TopTick" Width="{Binding ActualWidth,ElementName=TrackBackground}" Ticks="{TemplateBinding Ticks}" TickFrequency="{TemplateBinding TickFrequency}" Minimum="{TemplateBinding Minimum}" Maximum="{TemplateBinding Maximum}" IsDirectionReversed="{TemplateBinding IsDirectionReversed}" Fill="{TemplateBinding Foreground}" Height="4" Margin="0,0,0,2" Placement="Top" Grid.Row="0" Visibility="Collapsed"/>
<TickBar x:Name="BottomTick" Width="{Binding ActualWidth,ElementName=TrackBackground}" Ticks="{TemplateBinding Ticks}" TickFrequency="{TemplateBinding TickFrequency}" Minimum="{TemplateBinding Minimum}" Maximum="{TemplateBinding Maximum}" IsDirectionReversed="{TemplateBinding IsDirectionReversed}" Fill="{TemplateBinding Foreground}" Height="4" Margin="0,2,0,0" Placement="Bottom" Grid.Row="2" Visibility="Collapsed"/>
<Border x:Name="TrackBackground" Background="{TemplateBinding Background}" Margin="9,0" Grid.Row="1" Height="2" VerticalAlignment="center"/>
<controls:RangeTrack IsDirectionReversed="{TemplateBinding IsDirectionReversed}" Orientation="{TemplateBinding Orientation}" ValueStart="{TemplateBinding ValueStart}" ValueEnd="{TemplateBinding ValueEnd}" Minimum="{TemplateBinding Minimum}" Maximum="{TemplateBinding Maximum}" Margin="9,0" x:Name="PART_Track" Grid.Row="1">
<controls:RangeTrack.DecreaseRepeatButton>
<RepeatButton Interval="{TemplateBinding Interval}" Delay="{TemplateBinding Delay}" Command="{x:Static controls:RangeSlider.DecreaseLarge}" Style="{StaticResource SliderRepeatButtonHorizontalStyle}"/>
</controls:RangeTrack.DecreaseRepeatButton>
<controls:RangeTrack.CenterRepeatButton>
<RepeatButton Interval="{TemplateBinding Interval}" Delay="{TemplateBinding Delay}" Command="{x:Static controls:RangeSlider.CenterLarge}" Background="{DynamicResource PrimaryBrush}" Style="{StaticResource SliderRepeatButtonHorizontalStyle}"/>
</controls:RangeTrack.CenterRepeatButton>
<controls:RangeTrack.IncreaseRepeatButton>
<RepeatButton Interval="{TemplateBinding Interval}" Delay="{TemplateBinding Delay}" Command="{x:Static controls:RangeSlider.IncreaseLarge}" Style="{StaticResource SliderRepeatButtonHorizontalStyle}"/>
</controls:RangeTrack.IncreaseRepeatButton>
<controls:RangeTrack.ThumbStart>
<controls:RangeThumb Content="{TemplateBinding ValueStart}" ClipToBounds="False" Width="18" Margin="-9,0" Height="18" x:Name="ThumbStart" Focusable="False" OverridesDefaultStyle="True" Template="{StaticResource RangeSliderThumb}" VerticalAlignment="Center"/>
</controls:RangeTrack.ThumbStart>
<controls:RangeTrack.ThumbEnd>
<controls:RangeThumb Content="{TemplateBinding ValueEnd}" ClipToBounds="False" Width="18" Margin="-9,0" Height="18" x:Name="ThumbEnd" Focusable="False" OverridesDefaultStyle="True" Template="{StaticResource RangeSliderThumb}" VerticalAlignment="Center"/>
</controls:RangeTrack.ThumbEnd>
</controls:RangeTrack>
</Grid>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="controls:TipElement.Placement" Value="TopLeft"/>
<Condition Property="controls:TipElement.Visibility" Value="Visible"/>
</MultiTrigger.Conditions>
<Setter Property="Template" TargetName="ThumbStart" Value="{StaticResource TipRangeSliderThumbHorizontalTop}"/>
<Setter Property="Template" TargetName="ThumbEnd" Value="{StaticResource TipRangeSliderThumbHorizontalTop}"/>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="controls:TipElement.Placement" Value="BottomRight"/>
<Condition Property="controls:TipElement.Visibility" Value="Visible"/>
</MultiTrigger.Conditions>
<Setter Property="Template" TargetName="ThumbStart" Value="{StaticResource TipRangeSliderThumbHorizontalBottom}"/>
<Setter Property="Template" TargetName="ThumbEnd" Value="{StaticResource TipRangeSliderThumbHorizontalBottom}"/>
</MultiTrigger>
<Trigger Property="TickPlacement" Value="TopLeft">
<Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
</Trigger>
<Trigger Property="TickPlacement" Value="BottomRight">
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
</Trigger>
<Trigger Property="TickPlacement" Value="Both">
<Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="RangeSliderVertical" TargetType="controls:RangeSlider">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition MinWidth="{TemplateBinding MinWidth}" Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TickBar x:Name="TopTick" Height="{Binding ActualHeight,ElementName=TrackBackground}" Ticks="{TemplateBinding Ticks}" TickFrequency="{TemplateBinding TickFrequency}" Minimum="{TemplateBinding Minimum}" Maximum="{TemplateBinding Maximum}" IsDirectionReversed="{TemplateBinding IsDirectionReversed}" Grid.Column="0" Fill="{TemplateBinding Foreground}" Margin="0,0,2,0" Placement="Left" Visibility="Collapsed" Width="4"/>
<TickBar x:Name="BottomTick" Height="{Binding ActualHeight,ElementName=TrackBackground}" Ticks="{TemplateBinding Ticks}" TickFrequency="{TemplateBinding TickFrequency}" Minimum="{TemplateBinding Minimum}" Maximum="{TemplateBinding Maximum}" IsDirectionReversed="{TemplateBinding IsDirectionReversed}" Grid.Column="2" Fill="{TemplateBinding Foreground}" Margin="2,0,0,0" Placement="Right" Visibility="Collapsed" Width="4"/>
<Border x:Name="TrackBackground" Background="{TemplateBinding Background}" Margin="0,9" Grid.Column="1" HorizontalAlignment="center" Width="2"/>
<controls:RangeTrack IsDirectionReversed="{TemplateBinding IsDirectionReversed}" Orientation="{TemplateBinding Orientation}" ValueStart="{TemplateBinding ValueStart}" ValueEnd="{TemplateBinding ValueEnd}" Minimum="{TemplateBinding Minimum}" Maximum="{TemplateBinding Maximum}" Margin="0,9" x:Name="PART_Track" Grid.Column="1">
<controls:RangeTrack.DecreaseRepeatButton>
<RepeatButton Interval="{TemplateBinding Interval}" Delay="{TemplateBinding Delay}" Command="{x:Static controls:RangeSlider.DecreaseLarge}" Style="{StaticResource SliderRepeatButtonVerticalStyle}"/>
</controls:RangeTrack.DecreaseRepeatButton>
<controls:RangeTrack.CenterRepeatButton>
<RepeatButton Interval="{TemplateBinding Interval}" Delay="{TemplateBinding Delay}" Command="{x:Static controls:RangeSlider.CenterLarge}" Background="{DynamicResource PrimaryBrush}" Style="{StaticResource SliderRepeatButtonVerticalStyle}"/>
</controls:RangeTrack.CenterRepeatButton>
<controls:RangeTrack.IncreaseRepeatButton>
<RepeatButton Interval="{TemplateBinding Interval}" Delay="{TemplateBinding Delay}" Command="{x:Static controls:RangeSlider.IncreaseLarge}" Style="{StaticResource SliderRepeatButtonVerticalStyle}"/>
</controls:RangeTrack.IncreaseRepeatButton>
<controls:RangeTrack.ThumbStart>
<controls:RangeThumb Content="{TemplateBinding ValueStart}" Margin="0,-9" x:Name="ThumbStart" Focusable="False" Height="18" OverridesDefaultStyle="True" Template="{StaticResource RangeSliderThumb}" HorizontalAlignment="Center" Width="18"/>
</controls:RangeTrack.ThumbStart>
<controls:RangeTrack.ThumbEnd>
<controls:RangeThumb Content="{TemplateBinding ValueEnd}" Margin="0,-9" x:Name="ThumbEnd" Focusable="False" Height="18" OverridesDefaultStyle="True" Template="{StaticResource RangeSliderThumb}" HorizontalAlignment="Center" Width="18"/>
</controls:RangeTrack.ThumbEnd>
</controls:RangeTrack>
</Grid>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="controls:TipElement.Placement" Value="TopLeft"/>
<Condition Property="controls:TipElement.Visibility" Value="Visible"/>
</MultiTrigger.Conditions>
<Setter Property="Template" TargetName="ThumbStart" Value="{StaticResource TipRangeSliderThumbVerticalLeft}"/>
<Setter Property="Template" TargetName="ThumbEnd" Value="{StaticResource TipRangeSliderThumbVerticalLeft}"/>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="controls:TipElement.Placement" Value="BottomRight"/>
<Condition Property="controls:TipElement.Visibility" Value="Visible"/>
</MultiTrigger.Conditions>
<Setter Property="Template" TargetName="ThumbStart" Value="{StaticResource TipRangeSliderThumbVerticalRight}"/>
<Setter Property="Template" TargetName="ThumbEnd" Value="{StaticResource TipRangeSliderThumbVerticalRight}"/>
</MultiTrigger>
<Trigger Property="TickPlacement" Value="TopLeft">
<Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
</Trigger>
<Trigger Property="TickPlacement" Value="BottomRight">
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
</Trigger>
<Trigger Property="TickPlacement" Value="Both">
<Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style x:Key="RangeSliderBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="controls:RangeSlider">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource DarkPrimaryBrush}"/>
<Setter Property="Template" Value="{StaticResource RangeSliderHorizontal}"/>
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Template" Value="{StaticResource RangeSliderVertical}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value=".4"/>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
@@ -8,6 +8,7 @@
</ResourceDictionary.MergedDictionaries>
<Style x:Key="StepBarItemBaseStyle" TargetType="controls:StepBarItem">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Foreground" Value="{DynamicResource ThirdlyTextBrush}"/>
<Style.Triggers>
<Trigger Property="Status" Value="Complete">
@@ -106,6 +107,7 @@
</ControlTemplate>
<Style x:Key="StepBarBaseStyle" TargetType="controls:StepBar">
<Setter Property="Focusable" Value="False"/>
<Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemHorizontalTop}"/>
<Setter Property="Template" Value="{StaticResource StepBarHorizontalTopControlTemplate}"/>
<Setter Property="ItemsPanel" Value="{StaticResource StepBarHorizontalItemsPanelTemplate}"/>
@@ -9,8 +9,7 @@
<ResourceDictionary Source="../Button.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="TagBaseStyle" TargetType="controls:Tag">
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Style x:Key="TagBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="controls:Tag">
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="controls:BorderElement.CornerRadius" Value="15"/>
@@ -20,6 +19,19 @@
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Height" Value="30"/>
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="-2" Opacity=".6" SnapsToDevicePixels="true" Stroke="{DynamicResource SecondaryBorderBrush}" StrokeThickness="2" StrokeDashArray="1 1" RadiusX="15" RadiusY="15"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:Tag">
@@ -30,7 +42,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
<Button Name="ButtonClose" Visibility="{TemplateBinding ShowCloseButton,Converter={StaticResource Boolean2VisibilityConverter}}" Command="interactivity:ControlCommands.Close" Margin="10,0,0,0" Width="16" Grid.Column="1" Style="{StaticResource ButtonIcon}" Padding="0,11" controls:IconElement.Geometry="{StaticResource DeleteGeometry}" Foreground="{TemplateBinding Foreground}"/>
<Button Focusable="False" Name="ButtonClose" Visibility="{TemplateBinding ShowCloseButton,Converter={StaticResource Boolean2VisibilityConverter}}" Command="interactivity:ControlCommands.Close" Margin="10,0,0,0" Width="16" Grid.Column="1" Style="{StaticResource ButtonIcon}" Padding="0,11" controls:IconElement.Geometry="{StaticResource DeleteGeometry}" Foreground="{TemplateBinding Foreground}"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
@@ -62,6 +74,19 @@
<Setter Property="controls:BorderElement.CornerRadius" Value="15"/>
<Setter Property="Padding" Value="10"/>
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="-2" Opacity=".6" SnapsToDevicePixels="true" Stroke="{DynamicResource SecondaryBorderBrush}" StrokeThickness="2" StrokeDashArray="1 1" RadiusX="15" RadiusY="15"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
@@ -24,7 +24,7 @@
<ControlTemplate TargetType="controls:WatermarkTextBox">
<controls:SimplePanel x:Name="WatermarkContent">
<TextBlock Text="{TemplateBinding Watermark}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Foreground="{DynamicResource ThirdlyTextBrush}" Margin="{TemplateBinding Padding}" x:Name="PART_Watermark" Visibility="{TemplateBinding Text,Converter={StaticResource String2VisibilityReConverter}}"/>
<ScrollViewer Padding="{TemplateBinding Padding}" Margin="-2,0" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
<ScrollViewer Style="{x:Null}" Padding="{TemplateBinding Padding}" Margin="-2,0" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
</controls:SimplePanel>
</ControlTemplate>
</Setter.Value>
@@ -51,7 +51,7 @@
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border x:Name="border" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<ScrollViewer Padding="{TemplateBinding Padding}" Margin="-2,0" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
<ScrollViewer Style="{x:Null}" Padding="{TemplateBinding Padding}" Margin="-2,0" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
@@ -81,7 +81,7 @@
</StackPanel>
<Border x:Name="border" Grid.Row="1" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"/>
<TextBlock x:Name="Placeholder" Padding="1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Grid.Row="1" Visibility="{TemplateBinding Text,Converter={StaticResource String2VisibilityReConverter}}" HorizontalAlignment="Stretch" Style="{StaticResource TextBlockDefaultThiLight}" Text="{Binding Path=(controls:InfoElement.Placeholder),RelativeSource={RelativeSource TemplatedParent}}"/>
<ScrollViewer Padding="{TemplateBinding Padding}" Margin="-1,1" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Grid.Row="1" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
<ScrollViewer Style="{x:Null}" Padding="{TemplateBinding Padding}" Margin="-1,1" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Grid.Row="1" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
@@ -110,7 +110,7 @@
</StackPanel>
<Border x:Name="border" Grid.Column="1" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"/>
<TextBlock x:Name="Placeholder" Padding="1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Grid.Column="1" Visibility="{TemplateBinding Text,Converter={StaticResource String2VisibilityReConverter}}" HorizontalAlignment="Stretch" Style="{StaticResource TextBlockDefaultThiLight}" Text="{Binding Path=(controls:InfoElement.Placeholder),RelativeSource={RelativeSource TemplatedParent}}"/>
<ScrollViewer Padding="{TemplateBinding Padding}" Margin="-1,1" Grid.Column="1" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
<ScrollViewer Style="{x:Null}" Padding="{TemplateBinding Padding}" Margin="-1,1" Grid.Column="1" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
@@ -166,7 +166,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Visibility="{TemplateBinding Text,Converter={StaticResource String2VisibilityReConverter}}" HorizontalAlignment="Stretch" Style="{StaticResource TextBlockDefaultThiLight}" Text="{Binding Path=(controls:InfoElement.Placeholder),RelativeSource={RelativeSource TemplatedParent}}"/>
<ScrollViewer Margin="-2,0" Grid.Column="0" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
<ScrollViewer Style="{x:Null}" Margin="-2,0" Grid.Column="0" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
<Button Command="interactivity:ControlCommands.Clear" Margin="0,0,7,0" Visibility="Collapsed" Name="ButtonClear" Width="16" Grid.Column="1" Style="{StaticResource ButtonIcon}" Padding="0,6" controls:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}" Foreground="{Binding BorderBrush,ElementName=templateRoot}"/>
</Grid>
</Border>
@@ -226,7 +226,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Visibility="{TemplateBinding Text,Converter={StaticResource String2VisibilityReConverter}}" HorizontalAlignment="Stretch" Style="{StaticResource TextBlockDefaultThiLight}" Text="{Binding Path=(controls:InfoElement.Placeholder),RelativeSource={RelativeSource TemplatedParent}}"/>
<ScrollViewer Grid.Column="0" Margin="-2,0" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
<ScrollViewer Style="{x:Null}" Grid.Column="0" Margin="-2,0" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
<Button Command="interactivity:ControlCommands.Clear" Margin="0,0,7,0" Visibility="Collapsed" Name="ButtonClear" Width="16" Grid.Column="1" Style="{StaticResource ButtonIcon}" Padding="0,6" controls:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}" Foreground="{Binding BorderBrush,ElementName=templateRoot}"/>
</Grid>
</Border>
@@ -18,7 +18,7 @@
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}">
<Path x:Name="PathMain" Width="{TemplateBinding controls:IconElement.Width}" Height="{TemplateBinding controls:IconElement.Height}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding controls:IconElement.Geometry}"/>
<ContentPresenter x:Name="ContentPresenterMain" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<ContentPresenter x:Name="ContentPresenterMain" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</StackPanel>
</Border>
<Border Visibility="Collapsed" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="BorderChecked" BorderThickness="4" BorderBrush="{TemplateBinding BorderBrush}"/>
@@ -70,6 +70,8 @@
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="6,0,0,0"/>
<Setter Property="Width" Value="36"/>
<Setter Property="Height" Value="22"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
@@ -7,9 +7,11 @@
<ResourceDictionary Source="../../Basic/Geometries.xaml"/>
<ResourceDictionary Source="../../Basic/Behaviors.xaml"/>
<ResourceDictionary Source="../../Basic/Sizes.xaml"/>
<ResourceDictionary Source="../Base/BaseStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="TransferItemBaseStyle" TargetType="controls:TransferItem">
<Style x:Key="TransferItemBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="controls:TransferItem">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualMargin0}"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="CanDeselect" Value="True"/>
<Setter Property="SelfManage" Value="True"/>
@@ -64,6 +66,7 @@
</Style>
<Style x:Key="TransferGroupBaseStyle" TargetType="controls:TransferGroup">
<Setter Property="Focusable" Value="False"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
@@ -81,6 +84,7 @@
</Style>
<Style x:Key="TransferBaseStyle" TargetType="controls:Transfer">
<Setter Property="Focusable" Value="False"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="controls:BorderElement.CornerRadius" Value="4"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
@@ -65,15 +65,26 @@
</Setter>
</Style>
<Style x:Key="CalendarDayButtonStyle" TargetType="CalendarDayButton">
<Style x:Key="CalendarDayButtonStyle" BasedOn="{StaticResource BaseStyle}" TargetType="CalendarDayButton">
<Setter Property="MinWidth" Value="10"/>
<Setter Property="MinHeight" Value="10"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Width" Value="32"/>
<Setter Property="Height" Value="32"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="-2" Opacity=".6" SnapsToDevicePixels="true" Stroke="{DynamicResource SecondaryBorderBrush}" StrokeThickness="2" StrokeDashArray="1 1" RadiusX="16" RadiusY="16"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CalendarDayButton">
@@ -175,7 +186,7 @@
</Grid.RowDefinitions>
<Border Background="{Binding Path=(controls:TitleElement.Background),RelativeSource={RelativeSource TemplatedParent}}" Grid.ColumnSpan="3"/>
<Button x:Name="PART_PreviousButton" Width="50" HorizontalAlignment="Left" Grid.Column="0" Height="50" Padding="16" Focusable="False" Grid.Row="0" Style="{StaticResource ButtonIcon}" controls:IconElement.Geometry="{StaticResource LeftGeometry}"/>
<Button x:Name="PART_HeaderButton" Foreground="White" Grid.Column="1" FontSize="20" HorizontalAlignment="Center" Grid.Row="0" Style="{StaticResource ButtonCustom}"/>
<Button x:Name="PART_HeaderButton" Focusable="False" Foreground="White" Grid.Column="1" FontSize="20" HorizontalAlignment="Center" Grid.Row="0" Style="{StaticResource ButtonCustom}"/>
<Button x:Name="PART_NextButton" Width="50" HorizontalAlignment="Right" Height="50" Padding="16" Grid.Column="2" Focusable="False" Grid.Row="0" Style="{StaticResource ButtonIcon}" controls:IconElement.Geometry="{StaticResource RightGeometry}"/>
<Grid Width="240" Height="240" x:Name="PART_MonthView" Margin="10" Grid.ColumnSpan="3" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="1" Visibility="Visible">
<Grid.ColumnDefinitions>
@@ -9,7 +9,7 @@
</ResourceDictionary.MergedDictionaries>
<Style TargetType="controls:CalendarWithClock">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
@@ -59,7 +59,7 @@
<Style TargetType="controls:Clock">
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Width" Value="210"/>
<Setter Property="Height" Value="310"/>
@@ -143,7 +143,7 @@
<Style TargetType="controls:ListClock">
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Width" Value="210"/>
<Setter Property="VerticalAlignment" Value="Top"/>
@@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="clr-namespace:HandyControl.Controls">
<Style TargetType="controls:Col">
<Setter Property="Focusable" Value="False"/>
</Style>
</ResourceDictionary>
@@ -1,125 +1,10 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:langs="clr-namespace:HandyControl.Properties.Langs"
xmlns:controls="clr-namespace:HandyControl.Controls"
xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
xmlns:controls="clr-namespace:HandyControl.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Basic/Paths.xaml"/>
<ResourceDictionary Source="../Basic/Converters.xaml"/>
<ResourceDictionary Source="Slider.xaml"/>
<ResourceDictionary Source="Button.xaml"/>
<ResourceDictionary Source="ToggleButton.xaml"/>
<ResourceDictionary Source="Base/ColorPickerBaseStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="controls:ColorPicker">
<Setter Property="Width" Value="230"/>
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="UseLayoutRounding" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:ColorPicker">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="122"/>
<RowDefinition Height="110"/>
<RowDefinition Height="62"/>
<RowDefinition Height="62"/>
</Grid.RowDefinitions>
<Border BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Grid.RowSpan="4" Background="{TemplateBinding Background}"/>
<controls:SimplePanel Margin="1" Grid.Row="0">
<Border Background="{TemplateBinding BackColor}"/>
<Border>
<Border.Background>
<LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5">
<GradientStop Color="White" Offset="1"/>
<GradientStop Color="#80ffffff" Offset=".5"/>
<GradientStop Color="#00ffffff"/>
</LinearGradientBrush>
</Border.Background>
</Border>
<Border>
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset="1"/>
<GradientStop Color="#80000000" Offset=".5"/>
<GradientStop Color="#00000000"/>
</LinearGradientBrush>
</Border.Background>
</Border>
</controls:SimplePanel>
<Border Name="PART_BorderColor" Grid.Row="0" CornerRadius="2,2,0,0" ClipToBounds="True">
<Canvas Margin="-6">
<Border Name="PART_BorderPicker" Background="Transparent" Height="12" CornerRadius="6" Width="12" BorderThickness="1" BorderBrush="White">
<Border.Effect>
<DropShadowEffect ShadowDepth="0" Opacity=".4"/>
</Border.Effect>
</Border>
</Canvas>
</Border>
<Border Grid.Row="0" Background="Transparent" Name="PART_BorderDrag"/>
<Grid Margin="16,16,10,0" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="28"/>
</Grid.ColumnDefinitions>
<ToggleButton Name="PART_ButtonDropper" Width="16" Height="16" Margin="0,0,10,0" Style="{StaticResource ToggleButtonCustom}" controls:StatusSwitchElement.HideUncheckedElement="True">
<Path Data="{StaticResource DropperGeometry}" Fill="{DynamicResource PrimaryTextBrush}"/>
<controls:StatusSwitchElement.CheckedElement>
<Path Data="{StaticResource DropperGeometry}" Fill="{DynamicResource DarkPrimaryBrush}"/>
</controls:StatusSwitchElement.CheckedElement>
</ToggleButton>
<Border Grid.Row="0" Grid.Column="1" Width="32" Height="32" CornerRadius="16" Background="{StaticResource ColorPickerOpacityBrush}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"/>
<Border Grid.Row="0" Grid.Column="1" Width="32" Height="32" CornerRadius="16" Background="{TemplateBinding SelectedBrush}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"/>
<Slider Name="PART_SliderColor" LargeChange="0.01" SmallChange="0.01" Grid.ColumnSpan="2" Value="6" Maximum="6" Background="{StaticResource ColorPickerRainbowBrush}" Margin="2,1,0,0" Grid.Row="0" Grid.Column="2" VerticalAlignment="Top" Style="{StaticResource ColorPickerSlider}" IsMoveToPointEnabled="True"/>
<Slider Name="PART_SliderOpacity" Grid.ColumnSpan="2" IsSnapToTickEnabled="True" Value="{Binding ChannelA,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" Maximum="255" SmallChange="1" Foreground="{TemplateBinding SelectedBrushWithoutOpacity}" Background="{StaticResource ColorPickerOpacityBrush}" Margin="2,0,0,0" Grid.Row="0" Grid.Column="2" VerticalAlignment="Bottom" Style="{StaticResource ColorPickerSlider}" IsMoveToPointEnabled="True"/>
<StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="0,14,0,0" VerticalAlignment="Top" Visibility="{Binding ShowList[0],RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}">
<TextBox Padding="0" HorizontalContentAlignment="Center" Width="176" Text="{Binding SelectedBrush,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay,Converter={StaticResource Color2HexStrConverter},UpdateSourceTrigger=LostFocus}" FontSize="10" MaxLength="10" Height="24" />
<TextBlock Foreground="{DynamicResource ThirdlyTextBrush}" Margin="0,6,0,0" FontSize="10" Text="HEX" HorizontalAlignment="Center"/>
</StackPanel>
<UniformGrid Name="PART_PanelRgb" Visibility="{Binding ShowList[1],RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" Rows="1" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="-2,14,-2,0" VerticalAlignment="Top">
<StackPanel Margin="2,0">
<controls:NumericUpDown HorizontalContentAlignment="Center" Padding="2,0" Tag="R" Value="{Binding ChannelR,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" ShowUpDownButton="False" Maximum="255" Minimum="0" FontSize="10" Height="24" />
<TextBlock Foreground="{DynamicResource ThirdlyTextBrush}" Margin="0,6,0,0" FontSize="10" Text="R" HorizontalAlignment="Center"/>
</StackPanel>
<StackPanel Margin="2,0">
<controls:NumericUpDown HorizontalContentAlignment="Center" Padding="0" Tag="G" Value="{Binding ChannelG,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" ShowUpDownButton="False" Maximum="255" Minimum="0" FontSize="10" Height="24" />
<TextBlock Foreground="{DynamicResource ThirdlyTextBrush}" Margin="0,6,0,0" FontSize="10" Text="G" HorizontalAlignment="Center"/>
</StackPanel>
<StackPanel Margin="2,0">
<controls:NumericUpDown HorizontalContentAlignment="Center" Padding="0" Tag="B" Value="{Binding ChannelB,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" ShowUpDownButton="False" Maximum="255" Minimum="0" FontSize="10" Height="24" />
<TextBlock Foreground="{DynamicResource ThirdlyTextBrush}" Margin="0,6,0,0" FontSize="10" Text="B" HorizontalAlignment="Center"/>
</StackPanel>
<StackPanel Margin="2,0">
<controls:NumericUpDown HorizontalContentAlignment="Center" Padding="0" Value="{Binding ChannelA,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ShowUpDownButton="False" Maximum="255" Minimum="0" FontSize="10" Height="24" />
<TextBlock Foreground="{DynamicResource ThirdlyTextBrush}" Margin="0,6,0,0" FontSize="10" Text="A" HorizontalAlignment="Center"/>
</StackPanel>
</UniformGrid>
<Button Command="interactivity:ControlCommands.Switch" Padding="6" FontSize="8" BorderThickness="0" HorizontalAlignment="Right" Height="24" Width="20" Grid.Column="3" Grid.Row="1">
<Button.Content>
<Path Fill="#323534" Style="{StaticResource UpDownPathStyle}"/>
</Button.Content>
</Button>
</Grid>
<Border Grid.Row="2" BorderThickness="0,1,0,0" BorderBrush="{DynamicResource BorderBrush}">
<WrapPanel Name="PART_PanelColor" Margin="6" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Row="3" BorderThickness="0,1,0,0" BorderBrush="{DynamicResource BorderBrush}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Command="interactivity:ControlCommands.Cancel" Content="{x:Static langs:Lang.Cancel}" Width="80" Margin="0,0,16,0"/>
<Button Command="interactivity:ControlCommands.Confirm" Content="{x:Static langs:Lang.Confirm}" Width="80" Style="{StaticResource ButtonPrimary}"/>
</StackPanel>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style BasedOn="{StaticResource ColorPickerBaseStyle}" TargetType="controls:ColorPicker"/>
</ResourceDictionary>
@@ -1,5 +1,4 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Style TargetType="ContentControl">
<Setter Property="Focusable" Value="False"/>
@@ -23,7 +23,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<ToggleButton Padding="10,0,0,0" Foreground="{TemplateBinding Foreground}" Grid.ColumnSpan="2" HorizontalContentAlignment="Stretch" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Width="{TemplateBinding Width}" Height="{TemplateBinding MinHeight}" Style="{StaticResource ToggleButtonCustom}">
<ToggleButton Focusable="False" Padding="10,0,0,0" Foreground="{TemplateBinding Foreground}" Grid.ColumnSpan="2" HorizontalContentAlignment="Stretch" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Width="{TemplateBinding Width}" Height="{TemplateBinding MinHeight}" Style="{StaticResource ToggleButtonCustom}">
<ToggleButton.Content>
<Grid>
<Grid.ColumnDefinitions>
@@ -15,6 +15,7 @@
</Style>
<Style TargetType="controls:FlipClock">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:FlipClock">
@@ -13,6 +13,7 @@
</ResourceDictionary.MergedDictionaries>
<Style TargetType="controls:ImageViewer">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="MinWidth" Value="400"/>
<Setter Property="MinHeight" Value="250"/>
@@ -8,17 +8,15 @@
<ResourceDictionary Source="Button.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="PaginationButtonStyle" TargetType="RadioButton">
<Style x:Key="PaginationButtonStyle" BasedOn="{StaticResource BaseStyle}" TargetType="RadioButton">
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="GroupName" Value="1"/>
<Setter Property="Margin" Value="5,0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="RenderTransformOrigin" Value=".5,.5"/>
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="Tag" Value="0"/>
@@ -56,6 +54,7 @@
</Style>
<Style TargetType="controls:Pagination">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Height" Value="40"/>
<Setter Property="UseLayoutRounding" Value="True"/>
<Setter Property="Background" Value="Transparent"/>
@@ -1,760 +1,15 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Basic/Geometries.xaml"/>
<ResourceDictionary Source="../Basic/Effects.xaml"/>
<ResourceDictionary Source="Label.xaml"/>
<ResourceDictionary Source="Base/SliderBaseStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!--ColorPicker-->
<Style x:Key="ColorPickerSliderRepeatButtonBaseStyle" TargetType="RepeatButton">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style BasedOn="{StaticResource CompareSliderBaseStyle}" TargetType="controls:CompareSlider"/>
<ControlTemplate x:Key="ColorPickerSliderThumbTemplate" TargetType="Thumb">
<Border Width="13" Height="13" Background="White" CornerRadius="6.5"/>
</ControlTemplate>
<Style BasedOn="{StaticResource PreviewSliderBaseStyle}" TargetType="controls:PreviewSlider"/>
<ControlTemplate x:Key="ColorPickerSliderHorizontal" TargetType="Slider">
<controls:SimplePanel>
<Border Margin="7,0" Background="{TemplateBinding Background}" MaxHeight="11" CornerRadius="2"/>
<Border Margin="7,0" Background="{TemplateBinding Foreground}" MaxHeight="11" CornerRadius="2">
<Border.OpacityMask>
<LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5">
<GradientStop Color="Transparent" Offset="1"/>
<GradientStop Color="White" Offset="0"/>
</LinearGradientBrush>
</Border.OpacityMask>
</Border>
<Track x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource ColorPickerSliderRepeatButtonBaseStyle}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource ColorPickerSliderRepeatButtonBaseStyle}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Focusable="False" Height="13" Width="13" OverridesDefaultStyle="True" Template="{StaticResource ColorPickerSliderThumbTemplate}" VerticalAlignment="Center">
<Thumb.Effect>
<DropShadowEffect ShadowDepth="0" Opacity=".6"/>
</Thumb.Effect>
</Thumb>
</Track.Thumb>
</Track>
</controls:SimplePanel>
</ControlTemplate>
<ControlTemplate x:Key="ColorPickerSliderVertical" TargetType="Slider">
<controls:SimplePanel>
<Border Margin="0,7" CornerRadius="2" MaxWidth="11" Background="{TemplateBinding Background}"/>
<Border Margin="0,7" CornerRadius="2" MaxWidth="11" Background="{TemplateBinding Foreground}">
<Border.OpacityMask>
<LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5">
<GradientStop Color="Transparent" Offset="1"/>
<GradientStop Color="White" Offset="0"/>
</LinearGradientBrush>
</Border.OpacityMask>
</Border>
<Track x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource ColorPickerSliderRepeatButtonBaseStyle}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource ColorPickerSliderRepeatButtonBaseStyle}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Focusable="False" Height="13" OverridesDefaultStyle="True" Template="{StaticResource ColorPickerSliderThumbTemplate}" VerticalAlignment="Top" Width="13">
<Thumb.Effect>
<DropShadowEffect ShadowDepth="0" Opacity=".6"/>
</Thumb.Effect>
</Thumb>
</Track.Thumb>
</Track>
</controls:SimplePanel>
</ControlTemplate>
<Style x:Key="ColorPickerSlider" TargetType="Slider">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Foreground" Value="Transparent"/>
<Setter Property="Template" Value="{StaticResource ColorPickerSliderHorizontal}"/>
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Template" Value="{StaticResource ColorPickerSliderVertical}"/>
</Trigger>
</Style.Triggers>
</Style>
<LinearGradientBrush x:Key="ColorPickerRainbowBrush">
<GradientStop Color="#ff0000"/>
<GradientStop Color="#ff00ff" Offset="0.167"/>
<GradientStop Color="#0000ff" Offset="0.334"/>
<GradientStop Color="#00ffff" Offset="0.501"/>
<GradientStop Color="#00ff00" Offset="0.668"/>
<GradientStop Color="#ffff00" Offset="0.835"/>
<GradientStop Color="#ff0000" Offset="1"/>
</LinearGradientBrush>
<DrawingBrush x:Key="ColorPickerOpacityBrush" Viewport="0,0,12,11" ViewportUnits="Absolute" Stretch="None" TileMode="Tile">
<DrawingBrush.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="#d0cec7">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,6,5" />
<RectangleGeometry Rect="6,6,6,5" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#e7e7e2">
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,5,12,1" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
<!--CompareSlider-->
<Style x:Key="CompareSliderRepeatButtonTransparent" TargetType="RepeatButton">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<ContentPresenter Content="{TemplateBinding Content}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="CompareSliderThumbHorizontal" TargetType="Thumb">
<ControlTemplate.Resources>
<Storyboard x:Key="Storyboard1">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)" Storyboard.TargetName="PathLeft">
<EasingDoubleKeyFrame KeyTime="0" Value="-2"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)" Storyboard.TargetName="PathRight">
<EasingDoubleKeyFrame KeyTime="0" Value="2"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="Storyboard2">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)" Storyboard.TargetName="PathLeft">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)" Storyboard.TargetName="PathRight">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<controls:SimplePanel>
<Border Width="1" HorizontalAlignment="Center">
<Border.Background>
<DrawingBrush RenderOptions.CachingHint="Cache" Viewport="0,0,1,8" ViewportUnits="Absolute" Stretch="None" TileMode="Tile">
<DrawingBrush.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="{DynamicResource BorderBrush}">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,1,4" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Border.Background>
</Border>
<Border x:Name="grip" Width="30" Height="30" CornerRadius="15" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Background="White">
<controls:SimplePanel Width="30" Height="30" Margin="-1,-1,0,0">
<Path x:Name="PathLeft" Data="{StaticResource LeftGeometry}" StrokeThickness="1" Stroke="{DynamicResource PrimaryBrush}" Margin="6,8" HorizontalAlignment="Left" Stretch="Uniform" Width="12" Height="12" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<TransformGroup>
<TranslateTransform/>
</TransformGroup>
</Path.RenderTransform>
</Path>
<Path x:Name="PathRight" Data="{StaticResource RightGeometry}" StrokeThickness="1" Stroke="{DynamicResource PrimaryBrush}" Margin="6,8" HorizontalAlignment="Right" Stretch="Uniform" Width="12" Height="12" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<TransformGroup>
<TranslateTransform/>
</TransformGroup>
</Path.RenderTransform>
</Path>
</controls:SimplePanel>
</Border>
</controls:SimplePanel>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="grip" Value="{DynamicResource PrimaryBrush}"/>
<Setter Property="Stroke" TargetName="PathLeft" Value="White"/>
<Setter Property="Stroke" TargetName="PathRight" Value="White"/>
</Trigger>
<Trigger Property="IsDragging" Value="true">
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard2}"/>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="CompareSliderHorizontal" TargetType="controls:CompareSlider">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<controls:CompareTrack Margin="-14,0,-15,0" x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Margin="14,0,-15,0" Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border HorizontalAlignment="Left" Width="{TemplateBinding Width}">
<ContentPresenter Content="{TemplateBinding TargetContent}"/>
</Border>
</RepeatButton.Content>
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Margin="-15,0,15,0" Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border HorizontalAlignment="Right" Width="{TemplateBinding ActualWidth}">
<ContentPresenter Content="{TemplateBinding SourceContent}"/>
</Border>
</RepeatButton.Content>
</RepeatButton>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Focusable="False" OverridesDefaultStyle="True" Template="{StaticResource CompareSliderThumbHorizontal}" Width="30" Margin="0,0,0,0"/>
</Track.Thumb>
</controls:CompareTrack>
</Border>
</ControlTemplate>
<ControlTemplate x:Key="CompareSliderThumbVertical" TargetType="Thumb">
<ControlTemplate.Resources>
<Storyboard x:Key="Storyboard1">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)" Storyboard.TargetName="PathUp">
<EasingDoubleKeyFrame KeyTime="0" Value="-2"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)" Storyboard.TargetName="PathDown">
<EasingDoubleKeyFrame KeyTime="0" Value="2"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="Storyboard2">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)" Storyboard.TargetName="PathUp">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)" Storyboard.TargetName="PathDown">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<controls:SimplePanel>
<Border Height="1" VerticalAlignment="Center">
<Border.Background>
<DrawingBrush RenderOptions.CachingHint="Cache" Viewport="0,0,8,1" ViewportUnits="Absolute" Stretch="None" TileMode="Tile">
<DrawingBrush.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="{DynamicResource BorderBrush}">
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,4,1" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Border.Background>
</Border>
<Border x:Name="grip" Width="30" Height="30" CornerRadius="15" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Background="White">
<controls:SimplePanel Width="30" Height="30" Margin="-1,-1,0,0">
<Path x:Name="PathUp" Data="{StaticResource UpGeometry}" StrokeThickness="1" Stroke="{DynamicResource PrimaryBrush}" Margin="9,6" VerticalAlignment="Top" Stretch="Uniform" Width="12" Height="12" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<TransformGroup>
<TranslateTransform/>
</TransformGroup>
</Path.RenderTransform>
</Path>
<Path x:Name="PathDown" Data="{StaticResource DownGeometry}" StrokeThickness="1" Stroke="{DynamicResource PrimaryBrush}" Margin="9,6" VerticalAlignment="Bottom" Stretch="Uniform" Width="12" Height="12" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<TransformGroup>
<TranslateTransform/>
</TransformGroup>
</Path.RenderTransform>
</Path>
</controls:SimplePanel>
</Border>
</controls:SimplePanel>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true" SourceName="grip">
<Setter Property="Background" TargetName="grip" Value="{DynamicResource PrimaryBrush}"/>
<Setter Property="Stroke" TargetName="PathUp" Value="White"/>
<Setter Property="Stroke" TargetName="PathDown" Value="White"/>
</Trigger>
<Trigger Property="IsDragging" Value="true">
<Setter Property="Background" TargetName="grip" Value="{DynamicResource PrimaryBrush}"/>
<Setter Property="Stroke" TargetName="PathUp" Value="White"/>
<Setter Property="Stroke" TargetName="PathDown" Value="White"/>
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard2}"/>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="CompareSliderVertical" TargetType="controls:CompareSlider">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<controls:CompareTrack Margin="0,-14,0,-15" x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Margin="0,-15,0,15" Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border VerticalAlignment="Bottom" Height="{TemplateBinding Height}">
<ContentPresenter Content="{TemplateBinding TargetContent}"/>
</Border>
</RepeatButton.Content>
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Margin="0,14,0,-15" Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource CompareSliderRepeatButtonTransparent}">
<RepeatButton.Content>
<Border VerticalAlignment="Top" Height="{TemplateBinding Height}">
<ContentPresenter Content="{TemplateBinding SourceContent}"/>
</Border>
</RepeatButton.Content>
</RepeatButton>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Focusable="False" Height="30" OverridesDefaultStyle="True" Template="{StaticResource CompareSliderThumbVertical}" VerticalAlignment="Top"/>
</Track.Thumb>
</controls:CompareTrack>
</Border>
</ControlTemplate>
<Style TargetType="controls:CompareSlider">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="MinWidth" Value="30"/>
<Setter Property="MinHeight" Value="30"/>
<Setter Property="Template" Value="{StaticResource CompareSliderHorizontal}"/>
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Template" Value="{StaticResource CompareSliderVertical}"/>
</Trigger>
</Style.Triggers>
</Style>
<!--PreviewSlider-->
<Style x:Key="PreviewSliderRepeatButtonStyle" TargetType="RepeatButton">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border Background="Transparent" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
<Rectangle Fill="{TemplateBinding Background}" Height="2"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="PreviewSliderThumbHorizontal" TargetType="Thumb">
<Border Effect="{StaticResource EffectShadow1}" Name="BorderDot" BorderThickness="0" BorderBrush="{DynamicResource PrimaryBrush}" Width="18" Height="18" Background="White" CornerRadius="9"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource EffectShadow2}"/>
</Trigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="2" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="0" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="PreviewSliderHorizontal" TargetType="controls:PreviewSlider">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
</Grid.RowDefinitions>
<ContentControl x:Name="PART_ContentBorder" HorizontalAlignment="Left" VerticalAlignment="Bottom" Visibility="Hidden" Content="{TemplateBinding PreviewContent}" Margin="9,0,9,6"/>
<Border x:Name="TrackBackground" Background="{TemplateBinding Background}" Height="2" Grid.Row="1" VerticalAlignment="center" Margin="9,0"/>
<Track Margin="9,0" x:Name="PART_Track" Grid.Row="1">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Background="{DynamicResource PrimaryBrush}" Style="{StaticResource PreviewSliderRepeatButtonStyle}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource PreviewSliderRepeatButtonStyle}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb Margin="-9,0" x:Name="Thumb" Focusable="False" Height="18" OverridesDefaultStyle="True" Template="{StaticResource PreviewSliderThumbHorizontal}" VerticalAlignment="Center" Width="18"/>
</Track.Thumb>
</Track>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Visibility" Value="Visible" TargetName="PART_ContentBorder"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style TargetType="controls:PreviewSlider">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
<Setter Property="IsMoveToPointEnabled" Value="True"/>
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Template" Value="{StaticResource PreviewSliderHorizontal}"/>
</Style>
<!--Common-->
<Style x:Key="SliderRepeatButtonHorizontalStyle" TargetType="RepeatButton">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border Background="Transparent" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
<Rectangle StrokeThickness="0" Fill="{TemplateBinding Background}" Height="2"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SliderRepeatButtonVerticalStyle" TargetType="RepeatButton">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border Background="Transparent" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
<Rectangle StrokeThickness="0" Fill="{TemplateBinding Background}" Width="2"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="SliderThumb" TargetType="Thumb">
<Border Effect="{StaticResource EffectShadow1}" Name="BorderDot" BorderThickness="0" BorderBrush="{DynamicResource PrimaryBrush}" Width="18" Height="18" Background="White" CornerRadius="9"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource EffectShadow2}"/>
</Trigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="2" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="0" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="TipSliderThumbHorizontalTop" TargetType="Thumb">
<controls:InternalCanvas>
<Label Name="LabelValue" Opacity="0" Canvas.Bottom="28" Style="{StaticResource LabelPrimary}" Content="{Binding Value,RelativeSource={RelativeSource AncestorType=Slider}}"/>
<Border Canvas.Bottom="0" Effect="{StaticResource EffectShadow1}" Name="BorderDot" BorderThickness="0" BorderBrush="{DynamicResource PrimaryBrush}" Width="18" Height="18" Background="White" CornerRadius="9"/>
</controls:InternalCanvas>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource EffectShadow2}" TargetName="BorderDot"/>
<Setter Property="Opacity" Value="1" TargetName="LabelValue"/>
</Trigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="2" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="0" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="TipSliderThumbHorizontalBottom" TargetType="Thumb">
<controls:InternalCanvas>
<Label Name="LabelValue" Opacity="0" Canvas.Top="28" Style="{StaticResource LabelPrimary}" Content="{Binding Value,RelativeSource={RelativeSource AncestorType=Slider}}"/>
<Border Canvas.Bottom="0" Effect="{StaticResource EffectShadow1}" Name="BorderDot" BorderThickness="0" BorderBrush="{DynamicResource PrimaryBrush}" Width="18" Height="18" Background="White" CornerRadius="9"/>
</controls:InternalCanvas>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource EffectShadow2}" TargetName="BorderDot"/>
<Setter Property="Opacity" Value="1" TargetName="LabelValue"/>
</Trigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="2" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="0" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="TipSliderThumbVerticalLeft" TargetType="Thumb">
<controls:InternalCanvas Orientation="Vertical">
<Label Name="LabelValue" Opacity="0" Canvas.Right="28" Style="{StaticResource LabelPrimary}" Content="{Binding Value,RelativeSource={RelativeSource AncestorType=Slider}}"/>
<Border Canvas.Right="0" Effect="{StaticResource EffectShadow1}" Name="BorderDot" BorderThickness="0" BorderBrush="{DynamicResource PrimaryBrush}" Width="18" Height="18" Background="White" CornerRadius="9"/>
</controls:InternalCanvas>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource EffectShadow2}" TargetName="BorderDot"/>
<Setter Property="Opacity" Value="1" TargetName="LabelValue"/>
</Trigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="2" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="0" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="TipSliderThumbVerticalRight" TargetType="Thumb">
<controls:InternalCanvas Orientation="Vertical">
<Label Name="LabelValue" Opacity="0" Canvas.Left="28" Style="{StaticResource LabelPrimary}" Content="{Binding Value,RelativeSource={RelativeSource AncestorType=Slider}}"/>
<Border Canvas.Right="0" Effect="{StaticResource EffectShadow1}" Name="BorderDot" BorderThickness="0" BorderBrush="{DynamicResource PrimaryBrush}" Width="18" Height="18" Background="White" CornerRadius="9"/>
</controls:InternalCanvas>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource EffectShadow2}" TargetName="BorderDot"/>
<Setter Property="Opacity" Value="1" TargetName="LabelValue"/>
</Trigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="2" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimation To="0" Duration="0:0:.1" Storyboard.TargetName="BorderDot" Storyboard.TargetProperty="BorderThickness"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="SliderHorizontal" TargetType="Slider">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TickBar x:Name="TopTick" Fill="{TemplateBinding Foreground}" Height="4" Margin="0,0,0,2" Placement="Top" Grid.Row="0" Visibility="Collapsed"/>
<TickBar x:Name="BottomTick" Fill="{TemplateBinding Foreground}" Height="4" Margin="0,2,0,0" Placement="Bottom" Grid.Row="2" Visibility="Collapsed"/>
<Border x:Name="TrackBackground" Background="{TemplateBinding Background}" Grid.Row="1" Height="2" VerticalAlignment="center" Margin="9,0">
<Canvas x:Name="Canvas_SelectionRange" Visibility="Hidden">
<Rectangle x:Name="PART_SelectionRange" Fill="{DynamicResource AccentBrush}" Height="2"/>
</Canvas>
</Border>
<Track Margin="9,0" x:Name="PART_Track" Grid.Row="1">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Background="{DynamicResource PrimaryBrush}" Style="{StaticResource SliderRepeatButtonHorizontalStyle}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource SliderRepeatButtonHorizontalStyle}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb ClipToBounds="False" Width="18" Margin="-9,0" Height="18" x:Name="Thumb" Focusable="False" OverridesDefaultStyle="True" Template="{StaticResource SliderThumb}" VerticalAlignment="Center"/>
</Track.Thumb>
</Track>
</Grid>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="controls:TipElement.Placement" Value="TopLeft"/>
<Condition Property="controls:TipElement.Visibility" Value="Visible"/>
</MultiTrigger.Conditions>
<Setter Property="Template" TargetName="Thumb" Value="{StaticResource TipSliderThumbHorizontalTop}"/>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="controls:TipElement.Placement" Value="BottomRight"/>
<Condition Property="controls:TipElement.Visibility" Value="Visible"/>
</MultiTrigger.Conditions>
<Setter Property="Template" TargetName="Thumb" Value="{StaticResource TipSliderThumbHorizontalBottom}"/>
</MultiTrigger>
<Trigger Property="TickPlacement" Value="TopLeft">
<Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
</Trigger>
<Trigger Property="TickPlacement" Value="BottomRight">
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
</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="Canvas_SelectionRange" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="SliderVertical" TargetType="Slider">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition MinWidth="{TemplateBinding MinWidth}" Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TickBar x:Name="TopTick" Grid.Column="0" Fill="{TemplateBinding Foreground}" Margin="0,0,2,0" Placement="Left" Visibility="Collapsed" Width="4"/>
<TickBar x:Name="BottomTick" Grid.Column="2" Fill="{TemplateBinding Foreground}" Margin="2,0,0,0" Placement="Right" Visibility="Collapsed" Width="4"/>
<Border x:Name="TrackBackground" Background="{TemplateBinding Background}" Grid.Column="1" HorizontalAlignment="center" Margin="0,9" Width="2">
<Canvas x:Name="Canvas_SelectionRange" Visibility="Hidden">
<Rectangle x:Name="PART_SelectionRange" Fill="{DynamicResource AccentBrush}" Width="2"/>
</Canvas>
</Border>
<Track Margin="0,9" x:Name="PART_Track" Grid.Column="1">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Background="{DynamicResource PrimaryBrush}" Style="{StaticResource SliderRepeatButtonVerticalStyle}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource SliderRepeatButtonVerticalStyle}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb Margin="0,-9" x:Name="Thumb" Focusable="False" Height="18" OverridesDefaultStyle="True" Template="{StaticResource SliderThumb}" HorizontalAlignment="Center" Width="18"/>
</Track.Thumb>
</Track>
</Grid>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="controls:TipElement.Placement" Value="TopLeft"/>
<Condition Property="controls:TipElement.Visibility" Value="Visible"/>
</MultiTrigger.Conditions>
<Setter Property="Template" TargetName="Thumb" Value="{StaticResource TipSliderThumbVerticalLeft}"/>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="controls:TipElement.Placement" Value="BottomRight"/>
<Condition Property="controls:TipElement.Visibility" Value="Visible"/>
</MultiTrigger.Conditions>
<Setter Property="Template" TargetName="Thumb" Value="{StaticResource TipSliderThumbVerticalRight}"/>
</MultiTrigger>
<Trigger Property="TickPlacement" Value="TopLeft">
<Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
</Trigger>
<Trigger Property="TickPlacement" Value="BottomRight">
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
</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="Canvas_SelectionRange" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style x:Key="SliderBaseStyle" TargetType="Slider">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource DarkPrimaryBrush}"/>
<Setter Property="Template" Value="{StaticResource SliderHorizontal}"/>
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Template" Value="{StaticResource SliderVertical}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value=".4"/>
</Trigger>
</Style.Triggers>
</Style>
<Style BasedOn="{StaticResource RangeSliderBaseStyle}" TargetType="controls:RangeSlider"/>
<Style BasedOn="{StaticResource SliderBaseStyle}" TargetType="Slider"/>
@@ -64,6 +64,7 @@
<ResourceDictionary Source="Dialog.xaml"/>
<ResourceDictionary Source="SideMenu.xaml"/>
<ResourceDictionary Source="GridSplitter.xaml"/>
<ResourceDictionary Source="Col.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
@@ -56,7 +56,7 @@
</LinearGradientBrush>
</ContentPresenter.OpacityMask>
</ContentPresenter>
<Button Grid.Column="1" Command="interactivity:ControlCommands.Close" Visibility="{Binding ShowCloseButton,RelativeSource={RelativeSource AncestorType=controls:TabControl},Converter={StaticResource Boolean2VisibilityConverter}}" Background="Transparent" Style="{StaticResource ButtonCustom}" Width="28">
<Button Grid.Column="1" Focusable="False" Command="interactivity:ControlCommands.Close" Visibility="{Binding ShowCloseButton,RelativeSource={RelativeSource AncestorType=controls:TabControl},Converter={StaticResource Boolean2VisibilityConverter}}" Background="Transparent" Style="{StaticResource ButtonCustom}" Width="28">
<Path Fill="{DynamicResource PrimaryTextBrush}" Width="8" Height="8" Style="{StaticResource ClosePathStyle}"/>
</Button>
</Grid>
@@ -119,7 +119,7 @@
<Border.CacheMode>
<BitmapCache SnapsToDevicePixels="True"/>
</Border.CacheMode>
<Button Style="{StaticResource ButtonIcon}" Padding="8" controls:IconElement.Geometry="{StaticResource LeftGeometry}" Foreground="{DynamicResource PrimaryTextBrush}" Background="{DynamicResource SecondaryRegionBrush}" x:Name="PART_ScrollButtonLeft"/>
<Button Focusable="False" Style="{StaticResource ButtonIcon}" Padding="8" controls:IconElement.Geometry="{StaticResource LeftGeometry}" Foreground="{DynamicResource PrimaryTextBrush}" Background="{DynamicResource SecondaryRegionBrush}" x:Name="PART_ScrollButtonLeft"/>
</Border>
<controls:ScrollViewer HorizontalScrollBarVisibility="Hidden" CanMouseWheel="True" Orientation="Horizontal" IsEnableInertia="True" Grid.Row="0" Grid.Column="1" IsDeferredScrollingEnabled="True" x:Name="PART_OverflowScrollviewer">
<Border Background="{TemplateBinding Background}" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource BorderBrush}" >
@@ -139,7 +139,7 @@
<BitmapCache SnapsToDevicePixels="True"/>
</Border.CacheMode>
<StackPanel Orientation="Horizontal">
<Button Visibility="{TemplateBinding ShowScrollButton,Converter={StaticResource Boolean2VisibilityConverter}}" Style="{StaticResource ButtonIcon}" BorderBrush="{DynamicResource BorderBrush}" Padding="8" controls:IconElement.Geometry="{StaticResource RightGeometry}" Foreground="{DynamicResource PrimaryTextBrush}" Background="{DynamicResource SecondaryRegionBrush}" x:Name="PART_ScrollButtonRight"/>
<Button Focusable="False" Visibility="{TemplateBinding ShowScrollButton,Converter={StaticResource Boolean2VisibilityConverter}}" Style="{StaticResource ButtonIcon}" BorderBrush="{DynamicResource BorderBrush}" Padding="8" controls:IconElement.Geometry="{StaticResource RightGeometry}" Foreground="{DynamicResource PrimaryTextBrush}" Background="{DynamicResource SecondaryRegionBrush}" x:Name="PART_ScrollButtonRight"/>
<Border Visibility="{Binding Visibility,ElementName=PART_OverflowButton}" Width="1" Background="{DynamicResource BorderBrush}"/>
<controls:ContextMenuToggleButton x:Name="PART_OverflowButton" Visibility="Collapsed" Style="{StaticResource ToggleButtonIconTransparent}" controls:IconSwitchElement.Geometry="{StaticResource DownGeometry}" controls:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}"/>
</StackPanel>
@@ -8,6 +8,7 @@
</ResourceDictionary.MergedDictionaries>
<Style TargetType="controls:TimeBar">
<Setter Property="Focusable" Value="False"/>
<Setter Property="UseLayoutRounding" Value="True"/>
<Setter Property="BorderThickness" Value="0,1,0,0"/>
<Setter Property="Foreground" Value="White"/>
@@ -3,6 +3,7 @@
xmlns:controls="clr-namespace:HandyControl.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Border.xaml"/>
<ResourceDictionary Source="Base/ToggleButtonBaseStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
@@ -101,6 +102,124 @@
<!--开关-->
<Style x:Key="ToggleButtonSwitch" BasedOn="{StaticResource ToggleButtonSwitchBaseStyle}" TargetType="ToggleButton"/>
<!--翻转-->
<Style x:Key="ToggleButtonFlip" BasedOn="{StaticResource BaseStyle}" TargetType="ToggleButton">
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="30"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<ControlTemplate.Resources>
<Storyboard x:Key="StoryboardChecked">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="CheckedElement">
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1">
<EasingDoubleKeyFrame.EasingFunction>
<PowerEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="UnCheckedElement">
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0">
<EasingDoubleKeyFrame.EasingFunction>
<PowerEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="CheckedElement">
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1">
<EasingDoubleKeyFrame.EasingFunction>
<PowerEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="UnCheckedElement">
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0">
<EasingDoubleKeyFrame.EasingFunction>
<PowerEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="StoryboardUnChecked">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="CheckedElement">
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0">
<EasingDoubleKeyFrame.EasingFunction>
<PowerEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="UnCheckedElement">
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1">
<EasingDoubleKeyFrame.EasingFunction>
<PowerEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="CheckedElement">
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0">
<EasingDoubleKeyFrame.EasingFunction>
<PowerEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="UnCheckedElement">
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1">
<EasingDoubleKeyFrame.EasingFunction>
<PowerEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<Viewbox>
<controls:SimplePanel Height="28" Width="28">
<Border Name="UnCheckedElement" Style="{StaticResource BorderClip}" RenderTransformOrigin="0.5,0.5" SnapsToDevicePixels="true" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
<Border.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1"/>
</TransformGroup>
</Border.RenderTransform>
<ContentPresenter Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
<Border Name="CheckedElement" Style="{StaticResource BorderClip}" RenderTransformOrigin="0.5,0.5" SnapsToDevicePixels="true" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
<Border.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0"/>
</TransformGroup>
</Border.RenderTransform>
<ContentPresenter Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Content="{Binding Path=(controls:StatusSwitchElement.CheckedElement),RelativeSource={RelativeSource TemplatedParent}}"/>
</Border>
</controls:SimplePanel>
</Viewbox>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value=".9"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Opacity" Value=".6"/>
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource StoryboardChecked}"/>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource StoryboardUnChecked}"/>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--自定义-->
<Style x:Key="ToggleButtonCustom" BasedOn="{StaticResource BaseStyle}" TargetType="ToggleButton">
<Setter Property="Background" Value="Transparent"/>
@@ -115,7 +234,7 @@
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="Chrome" SnapsToDevicePixels="true" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
<controls:SimplePanel>
<ContentPresenter Name="UnCheckedElement" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<ContentPresenter Name="UnCheckedElement" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<ContentPresenter Name="CheckedElement" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Visibility="Collapsed" Content="{Binding Path=(controls:StatusSwitchElement.CheckedElement),RelativeSource={RelativeSource TemplatedParent}}"/>
</controls:SimplePanel>
</Border>
@@ -0,0 +1,17 @@
using System;
using System.ComponentModel;
using System.Globalization;
// ReSharper disable ConditionIsAlwaysTrueOrFalse
// ReSharper disable HeuristicUnreachableCode
namespace HandyControl.Tools.Converter
{
public class NameReferenceConverter : System.Windows.Markup.NameReferenceConverter
{
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
=> context == null ? null : base.ConvertFrom(context, culture, value);
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
=> context == null ? null : base.ConvertTo(context, culture, value, destinationType);
}
}
@@ -0,0 +1,58 @@
using System.Windows;
namespace HandyControl.Tools.Extension
{
public static class FrameworkElementExtension
{
public static double GetValidWidth(this FrameworkElement element)
{
if (!double.IsNaN(element.Width))
{
if (element.Width > 0)
{
return element.Width;
}
}
else
{
if (element.ActualWidth > 0)
{
return element.ActualWidth;
}
if (element.DesiredSize.Width > 0)
{
return element.DesiredSize.Width;
}
}
return 0;
}
public static double GetValidHeight(this FrameworkElement element)
{
if (!double.IsNaN(element.Height))
{
if (element.Height > 0)
{
return element.Height;
}
}
else
{
if (element.ActualHeight > 0)
{
return element.ActualHeight;
}
if (element.DesiredSize.Height > 0)
{
return element.DesiredSize.Height;
}
}
return 0;
}
}
}
@@ -0,0 +1,32 @@
using System;
using System.ComponentModel;
namespace HandyControl.Tools.Extension
{
public static class StringExtension
{
public static T Value<T>(this string input)
{
try
{
return (T)TypeDescriptor.GetConverter(typeof(T)).ConvertFromString(input);
}
catch
{
return default(T);
}
}
public static object Value(this string input, Type type)
{
try
{
return TypeDescriptor.GetConverter(type).ConvertFromString(input);
}
catch
{
return null;
}
}
}
}
@@ -162,7 +162,7 @@ namespace HandyControl.Tools
try
{
// Find the corresponding reference and remove it
for (int i = 0; i < ImageInfoList.Count; i++)
for (var i = 0; i < ImageInfoList.Count; i++)
{
var imageInfo = ImageInfoList[i];
@@ -27,23 +27,23 @@ namespace HandyControl.Tools
}
var index = 0;
for (int i = 0; i < 2; i++)
for (var i = 0; i < 2; i++)
{
for (int j = 0; j < 5; j++, index++)
for (var j = 0; j < 5; j++, index++)
{
AddRec(i, j, renderData[index] == 0);
}
}
for (int j = 0; j < 5; j++, index++)
for (var j = 0; j < 5; j++, index++)
{
AddRec(2, j, renderData[index] == 0);
}
index -= 10;
for (int i = 3; i < 5; i++)
for (var i = 3; i < 5; i++)
{
for (int j = 0; j < 5; j++, index++)
for (var j = 0; j < 5; j++, index++)
{
AddRec(i, j, renderData[index] == 0);
}
@@ -78,7 +78,7 @@ namespace HandyControl.Tools
private int[] GetRenderData(string hashcode)
{
var arr = new int[RenderDataMaxLength];
for (int i = 0; i < RenderDataMaxLength; i++)
for (var i = 0; i < RenderDataMaxLength; i++)
{
var c = hashcode[i];
var v = (int) c;
@@ -22,11 +22,11 @@ namespace HandyControl.Tools
var arr = new int[count];
var div = num / count;
var rest = num % count;
for (int i = 0; i < count; i++)
for (var i = 0; i < count; i++)
{
arr[i] = div;
}
for (int i = 0; i < rest; i++)
for (var i = 0; i < rest; i++)
{
arr[i] += 1;
}
@@ -36,9 +36,9 @@ namespace HandyControl.Tools
/// <summary>
/// 计算控件在窗口中的可见坐标
/// </summary>
public static Point CalSafePoint(FrameworkElement element, FrameworkElement showElement, Thickness thickness = default(Thickness))
public static Point CalSafePoint(FrameworkElement element, FrameworkElement showElement, Thickness thickness = default)
{
if (element == null || showElement == null) return default(Point);
if (element == null || showElement == null) return default;
var point = element.PointToScreen(new Point(0, 0));
if (point.X < 0) point.X = 0;
@@ -122,19 +122,6 @@ namespace HandyControl.Tools
/// <returns></returns>
public static double CalAngle(Point center, Point p) => Math.Atan2(p.Y - center.Y, p.X - center.X) * 180 / Math.PI;
/// <summary>
/// 判断是否是有效的双精度浮点数
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static bool IsValidDoubleValue(object value)
{
var d = (double)value;
if (!double.IsNaN(d))
return !double.IsInfinity(d);
return false;
}
/// <summary>
/// 计算法线
/// </summary>
@@ -197,7 +197,7 @@ namespace HandyControl.Tools
var isBitmapIconDecoder = frames[0].Decoder is IconBitmapDecoder;
for (int i = 0; i < frames.Count && bestScore != 0; ++i)
for (var i = 0; i < frames.Count && bestScore != 0; ++i)
{
var currentIconBitDepth = isBitmapIconDecoder ? frames[i].Thumbnail.Format.BitsPerPixel : frames[i].Format.BitsPerPixel;
@@ -20,24 +20,88 @@
/// 是否在正浮点数范围内
/// </summary>
/// <param name="value"></param>
/// <param name="includeZero"></param>
/// <returns></returns>
public static bool IsInRangeOfPosDouble(object value, bool includeZero = false)
public static bool IsInRangeOfPosDouble(object value)
{
var v = (double)value;
return !(double.IsNaN(v) || double.IsInfinity(v)) && (includeZero ? v >= 0 : v > 0);
return !(double.IsNaN(v) || double.IsInfinity(v)) && v > 0;
}
/// <summary>
/// 是否在正浮点数范围内(包括0)
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static bool IsInRangeOfPosDoubleIncludeZero(object value)
{
var v = (double)value;
return !(double.IsNaN(v) || double.IsInfinity(v)) && v >= 0;
}
/// <summary>
/// 是否在负浮点数范围内
/// </summary>
/// <param name="value"></param>
/// <param name="includeZero"></param>
/// <returns></returns>
public static bool IsInRangeOfNegDouble(object value, bool includeZero = false)
public static bool IsInRangeOfNegDouble(object value)
{
var v = (double)value;
return !(double.IsNaN(v) || double.IsInfinity(v)) && (includeZero ? v <= 0 : v < 0);
return !(double.IsNaN(v) || double.IsInfinity(v)) && v < 0;
}
/// <summary>
/// 是否在负浮点数范围内(包括0)
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static bool IsInRangeOfNegDoubleIncludeZero(object value)
{
var v = (double)value;
return !(double.IsNaN(v) || double.IsInfinity(v)) && v <= 0;
}
/// <summary>
/// 是否在正整数范围内
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static bool IsInRangeOfPosInt(object value)
{
var v = (int)value;
return v > 0;
}
/// <summary>
/// 是否在正整数范围内(包括0)
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static bool IsInRangeOfPosIntIncludeZero(object value)
{
var v = (int)value;
return v >= 0;
}
/// <summary>
/// 是否在负整数范围内
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static bool IsInRangeOfNegInt(object value)
{
var v = (int)value;
return v < 0;
}
/// <summary>
/// 是否在负整数范围内(包括0)
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static bool IsInRangeOfNegIntIncludeZero(object value)
{
var v = (int)value;
return v <= 0;
}
}
}
@@ -34,7 +34,7 @@ namespace HandyControl.Tools
return t;
}
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(d); i++)
for (var i = 0; i < VisualTreeHelper.GetChildrenCount(d); i++)
{
var child = VisualTreeHelper.GetChild(d, i);
@@ -42,7 +42,7 @@ namespace HandyControl.Tools
if (result != null) return result;
}
return default(T);
return default;
}
/// <summary>
@@ -6,7 +6,7 @@ using HandyControl.Tools.Interop;
namespace HandyControl.Tools
{
internal class KeyboardHook
public class KeyboardHook
{
public static event EventHandler<KeyboardHookEventArgs> KeyDown;
@@ -0,0 +1,9 @@
namespace HandyControl.Tools
{
public interface IPool<T>
{
T Acquire();
bool Release(T instance);
}
}
@@ -0,0 +1,64 @@
//adapted from https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/util/Pools.java
using System;
namespace HandyControl.Tools
{
public class SimplePool<T> : IPool<T>
{
private readonly object[] _pool;
private int _poolSize;
public SimplePool(int maxPoolSize)
{
if (maxPoolSize <= 0)
{
throw new ArgumentException("The max pool size must be > 0");
}
_pool = new object[maxPoolSize];
}
public virtual T Acquire()
{
if (_poolSize > 0)
{
var lastPooledIndex = _poolSize - 1;
var instance = (T)_pool[lastPooledIndex];
_pool[lastPooledIndex] = null;
_poolSize--;
return instance;
}
return default;
}
public virtual bool Release(T instance)
{
if (IsInPool(instance))
{
throw new Exception("Already in the pool!");
}
if (_poolSize < _pool.Length)
{
_pool[_poolSize] = instance;
_poolSize++;
return true;
}
return false;
}
private bool IsInPool(T instance)
{
for (var i = 0; i < _poolSize; i++)
{
if (Equals(_pool[i], instance))
{
return true;
}
}
return false;
}
}
}
@@ -0,0 +1,27 @@
namespace HandyControl.Tools
{
public class SynchronizedPool<T> : SimplePool<T>
{
private readonly object _lockObj = new object();
public SynchronizedPool(int maxPoolSize) : base(maxPoolSize)
{
}
public override T Acquire()
{
lock (_lockObj)
{
return base.Acquire();
}
}
public override bool Release(T element)
{
lock (_lockObj) {
return base.Release(element);
}
}
}
}
@@ -0,0 +1,345 @@
// adapted from https://www.c-sharpcorner.com/uploadfile/b942f9/implementing-a-double-ended-queue-or-deque-in-c-sharp/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
namespace HandyControl.Tools
{
[Serializable]
public class Deque<T> : IEnumerable<T>, ICollection
{
[NonSerialized]
private object _syncRoot;
private List<T> _front;
private List<T> _back;
private int _frontDeleted;
private int _backDeleted;
public int Capacity => _front.Capacity + _back.Capacity;
public int Count => _front.Count + _back.Count - _frontDeleted - _backDeleted;
public bool IsEmpty => Count == 0;
public IEnumerable<T> Reversed
{
get
{
if (_back.Count - _backDeleted > 0)
{
for (var i = _back.Count - 1; i >= _backDeleted; i--) yield return _back[i];
}
if (_front.Count - _frontDeleted > 0)
{
for (var i = _frontDeleted; i < _front.Count; i++) yield return _front[i];
}
}
}
public Deque()
{
_front = new List<T>();
_back = new List<T>();
}
public Deque(int capacity)
{
if (capacity < 0) throw new ArgumentException("Capacity cannot be negative");
var temp = capacity / 2;
var temp2 = capacity - temp;
_front = new List<T>(temp);
_back = new List<T>(temp2);
}
public Deque(IEnumerable<T> backCollection) : this(backCollection, null)
{
}
public Deque(IEnumerable<T> backCollection, IEnumerable<T> frontCollection)
{
if (backCollection == null && frontCollection == null) throw new ArgumentException("Collections cannot both be null");
_front = new List<T>();
_back = new List<T>();
if (backCollection != null)
{
foreach (var item in backCollection) _back.Add(item);
}
if (frontCollection != null)
{
foreach (var item in frontCollection) _front.Add(item);
}
}
public void AddFirst(T item)
{
if (_frontDeleted > 0 && _front.Count == _front.Capacity)
{
_front.RemoveRange(0, _frontDeleted);
_frontDeleted = 0;
}
_front.Add(item);
}
public void AddLast(T item)
{
if (_backDeleted > 0 && _back.Count == _back.Capacity)
{
_back.RemoveRange(0, _backDeleted);
_backDeleted = 0;
}
_back.Add(item);
}
public void AddRangeFirst(IEnumerable<T> range)
{
if (range == null) return;
foreach (var item in range) AddFirst(item);
}
public void AddRangeLast(IEnumerable<T> range)
{
if (range == null) return;
foreach (var item in range) AddLast(item);
}
public void Clear()
{
_front.Clear();
_back.Clear();
_frontDeleted = 0;
_backDeleted = 0;
}
public bool Contains(T item)
{
for (var i = _frontDeleted; i < _front.Count; i++)
{
if (Equals(_front[i], item)) return true;
}
for (var i = _backDeleted; i < _back.Count; i++)
{
if (Equals(_back[i], item)) return true;
}
return false;
}
public void CopyTo(T[] array, int index)
{
if (array == null) throw new ArgumentNullException("Array cannot be null");
if (index < 0) throw new ArgumentOutOfRangeException("Index cannot be negative");
if (array.Length < index + Count) throw new ArgumentException("Index is invalid");
var i = index;
foreach (var item in this)
{
array[i++] = item;
}
}
public IEnumerator<T> GetEnumerator()
{
if (_front.Count - _frontDeleted > 0)
{
for (var i = _front.Count - 1; i >= _frontDeleted; i--) yield return _front[i];
}
if (_back.Count - _backDeleted > 0)
{
for (var i = _backDeleted; i < _back.Count; i++) yield return _back[i];
}
}
public T PeekFirst()
{
if (_front.Count > _frontDeleted)
{
return _front[_front.Count - 1];
}
if (_back.Count > _backDeleted)
{
return _back[_backDeleted];
}
throw new InvalidOperationException("Can't peek at empty Deque");
}
public T PeekLast()
{
if (_back.Count > _backDeleted)
{
return _back[_back.Count - 1];
}
if (_front.Count > _frontDeleted)
{
return _front[_frontDeleted];
}
throw new InvalidOperationException("Can't peek at empty Deque");
}
public T PopFirst()
{
T result;
if (_front.Count > _frontDeleted)
{
result = _front[_front.Count - 1];
_front.RemoveAt(_front.Count - 1);
}
else if (_back.Count > _backDeleted)
{
result = _back[_backDeleted];
_backDeleted++;
}
else
{
throw new InvalidOperationException("Can't pop empty Deque");
}
return result;
}
public T PopLast()
{
T result;
if (_back.Count > _backDeleted)
{
result = _back[_back.Count - 1];
_back.RemoveAt(_back.Count - 1);
}
else if (_front.Count > _frontDeleted)
{
result = _front[_frontDeleted];
_frontDeleted++;
}
else
{
throw new InvalidOperationException("Can't pop empty Deque");
}
return result;
}
public void Reverse()
{
var temp = _front;
_front = _back;
_back = temp;
var temp2 = _frontDeleted;
_frontDeleted = _backDeleted;
_backDeleted = temp2;
}
public T[] ToArray()
{
if (Count == 0) return new T[0];
var result = new T[Count];
CopyTo(result, 0);
return result;
}
public void TrimExcess()
{
if (_frontDeleted > 0)
{
_front.RemoveRange(0, _frontDeleted);
_frontDeleted = 0;
}
if (_backDeleted > 0)
{
_back.RemoveRange(0, _backDeleted);
_backDeleted = 0;
}
_front.TrimExcess();
_back.TrimExcess();
}
public bool TryPeekFirst(out T item)
{
if (!IsEmpty)
{
item = PeekFirst();
return true;
}
item = default;
return false;
}
public bool TryPeekLast(out T item)
{
if (!IsEmpty)
{
item = PeekLast();
return true;
}
item = default;
return false;
}
public bool TryPopFirst(out T item)
{
if (!IsEmpty)
{
item = PopFirst();
return true;
}
item = default;
return false;
}
public bool TryPopLast(out T item)
{
if (!IsEmpty)
{
item = PopLast();
return true;
}
item = default;
return false;
}
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot
{
get
{
if (_syncRoot == null)
{
Interlocked.CompareExchange<object>(ref _syncRoot, new object(), null);
}
return _syncRoot;
}
}
void ICollection.CopyTo(Array array, int index) => CopyTo((T[])array, index);
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
}