diff --git a/ChangeLog.txt b/ChangeLog.txt index ca9d9848..68e6fdd2 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,11 @@ +2018.08.31 Version 1.1.2 +* new controls + - add CompareSlider + +2018.08.30 Version 1.1.1 +* new controls + - add ScrollViewer + 2018.08.27 Version 1.1.0 * new controls diff --git a/HandyControl/Controls/Carousel.xaml b/HandyControl/Controls/Carousel.xaml index 1281770d..ef82e01e 100644 --- a/HandyControl/Controls/Carousel.xaml +++ b/HandyControl/Controls/Carousel.xaml @@ -3,7 +3,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:interactivity="clr-namespace:HandyControl.Interactivity" mc:Ignorable="d" BorderThickness="1" Background="Transparent" diff --git a/HandyControl/Controls/CompareSlider.cs b/HandyControl/Controls/CompareSlider.cs new file mode 100644 index 00000000..9f60d8db --- /dev/null +++ b/HandyControl/Controls/CompareSlider.cs @@ -0,0 +1,47 @@ +using System.Windows; +using System.Windows.Controls; + +namespace HandyControl.Controls +{ + public class CompareSlider : Slider + { + public static readonly DependencyProperty TargetContentProperty = DependencyProperty.Register( + "TargetContent", typeof(object), typeof(CompareSlider), new PropertyMetadata(default(object))); + + public static readonly DependencyProperty SourceContentProperty = DependencyProperty.Register( + "SourceContent", typeof(object), typeof(CompareSlider), new PropertyMetadata(default(object))); + + public object TargetContent + { + get => GetValue(TargetContentProperty); + set => SetValue(TargetContentProperty, value); + } + + public object SourceContent + { + get => GetValue(SourceContentProperty); + set => SetValue(SourceContentProperty, value); + } + + private bool _isLoaded; + + private double _tempValue; + + public CompareSlider() + { + Loaded += delegate + { + if (_isLoaded) return; + _isLoaded = true; + Value = _tempValue; + }; + } + + public override void OnApplyTemplate() + { + base.OnApplyTemplate(); + _tempValue = Value; + Value = Orientation == Orientation.Horizontal ? Maximum : 0; + } + } +} \ No newline at end of file diff --git a/HandyControl/HandyControl.csproj b/HandyControl/HandyControl.csproj index ea08b677..06606ba7 100644 --- a/HandyControl/HandyControl.csproj +++ b/HandyControl/HandyControl.csproj @@ -12,6 +12,7 @@ 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 + true @@ -41,6 +42,7 @@ ColorPicker.xaml + diff --git a/HandyControl/Themes/Styles/Slider.xaml b/HandyControl/Themes/Styles/Slider.xaml index 0cdae6ec..1eeb1647 100644 --- a/HandyControl/Themes/Styles/Slider.xaml +++ b/HandyControl/Themes/Styles/Slider.xaml @@ -1,5 +1,11 @@  + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:controls="clr-namespace:HandyControl.Controls"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/HandyControlDemo/HandyControlDemo.csproj b/HandyControlDemo/HandyControlDemo.csproj index 27717b2b..4195c6c7 100644 --- a/HandyControlDemo/HandyControlDemo.csproj +++ b/HandyControlDemo/HandyControlDemo.csproj @@ -83,5 +83,9 @@ + + + + \ No newline at end of file diff --git a/HandyControlDemo/MainWindow.xaml b/HandyControlDemo/MainWindow.xaml index 9415a02a..e4cb0d25 100644 --- a/HandyControlDemo/MainWindow.xaml +++ b/HandyControlDemo/MainWindow.xaml @@ -424,6 +424,53 @@ + + + + + + + + + + (CompareSlider) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HandyControlDemo/Resources/b1.jpg b/HandyControlDemo/Resources/b1.jpg new file mode 100644 index 00000000..5675b30d Binary files /dev/null and b/HandyControlDemo/Resources/b1.jpg differ diff --git a/HandyControlDemo/Resources/b2.jpg b/HandyControlDemo/Resources/b2.jpg new file mode 100644 index 00000000..a221a30d Binary files /dev/null and b/HandyControlDemo/Resources/b2.jpg differ diff --git a/README.md b/README.md index 2b1d0967..47eb67e5 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,11 @@ ![图片浏览器ImageBrowser](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/ImageBrowser.gif) +### 8、对比滑块CompareSlider +![对比滑块CompareSlider](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/CompareSlider-h.gif) + +![对比滑块CompareSlider](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/CompareSlider-v.gif) + # 使用方法 第一步:添加HandyControl的引用; diff --git a/Resources/CompareSlider-h.gif b/Resources/CompareSlider-h.gif new file mode 100644 index 00000000..9f01e150 Binary files /dev/null and b/Resources/CompareSlider-h.gif differ diff --git a/Resources/CompareSlider-v.gif b/Resources/CompareSlider-v.gif new file mode 100644 index 00000000..0ac49668 Binary files /dev/null and b/Resources/CompareSlider-v.gif differ diff --git a/Resources/nuget-version.png b/Resources/nuget-version.png index 0ba48b13..f8f86c9c 100644 Binary files a/Resources/nuget-version.png and b/Resources/nuget-version.png differ