diff --git a/HandyControl/Controls/CircleProgressBar.cs b/HandyControl/Controls/CircleProgressBar.cs
index 9da8314b..bcefe80c 100644
--- a/HandyControl/Controls/CircleProgressBar.cs
+++ b/HandyControl/Controls/CircleProgressBar.cs
@@ -11,7 +11,7 @@ namespace HandyControl.Controls
private const string IndicatorTemplateName = "PART_Indicator";
public static readonly DependencyProperty ArcThicknessProperty = DependencyProperty.Register(
- "ArcThickness", typeof(double), typeof(CircleProgressBar), new PropertyMetadata(ValueBoxes.Double0Box));
+ "ArcThickness", typeof(double), typeof(CircleProgressBar), new PropertyMetadata(.0));
public static readonly DependencyProperty ShowTextProperty = DependencyProperty.Register(
"ShowText", typeof(bool), typeof(CircleProgressBar), new PropertyMetadata(ValueBoxes.TrueBox));
@@ -20,9 +20,8 @@ namespace HandyControl.Controls
static CircleProgressBar()
{
- FocusableProperty.OverrideMetadata(typeof(CircleProgressBar),
- new FrameworkPropertyMetadata(ValueBoxes.FalseBox));
- MaximumProperty.OverrideMetadata(typeof(CircleProgressBar), new PropertyMetadata(ValueBoxes.Double100Box));
+ FocusableProperty.OverrideMetadata(typeof(CircleProgressBar), new FrameworkPropertyMetadata(ValueBoxes.FalseBox));
+ MaximumProperty.OverrideMetadata(typeof(CircleProgressBar), new FrameworkPropertyMetadata(ValueBoxes.Double100Box));
}
public bool ShowText
diff --git a/HandyControl/Controls/ImageViewer.cs b/HandyControl/Controls/ImageViewer.cs
index 7b6c237c..c319a5aa 100644
--- a/HandyControl/Controls/ImageViewer.cs
+++ b/HandyControl/Controls/ImageViewer.cs
@@ -3,6 +3,7 @@ using System.Diagnostics;
using System.IO;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
@@ -218,6 +219,9 @@ namespace HandyControl.Controls
public static readonly DependencyProperty ImageSourceProperty = DependencyProperty.Register(
"ImageSource", typeof(BitmapFrame), typeof(ImageViewer), new PropertyMetadata(default(BitmapFrame)));
+ public static readonly DependencyProperty IsFullScreenProperty = DependencyProperty.Register(
+ "IsFullScreen", typeof(bool), typeof(ImageViewer), new PropertyMetadata(ValueBoxes.FalseBox));
+
internal static readonly DependencyProperty ImgPathProperty = DependencyProperty.Register(
"ImgPath", typeof(string), typeof(ImageViewer), new PropertyMetadata(default(string)));
@@ -260,6 +264,12 @@ namespace HandyControl.Controls
internal static readonly DependencyProperty ShowSmallImgInternalProperty = DependencyProperty.Register(
"ShowSmallImgInternal", typeof(bool), typeof(ImageViewer), new PropertyMetadata(ValueBoxes.FalseBox));
+ public bool IsFullScreen
+ {
+ get => (bool)GetValue(IsFullScreenProperty);
+ set => SetValue(IsFullScreenProperty, value);
+ }
+
public bool ShowImgMap
{
get => (bool)GetValue(ShowImgMapProperty);
@@ -397,7 +407,13 @@ namespace HandyControl.Controls
_imageMain = GetTemplateChild(ElementImageMain) as Image;
_borderBottom = GetTemplateChild(ElementBorderBottom) as Border;
- if (_imageMain != null) _imageMain.MouseLeftButtonDown += ImageMain_OnMouseLeftButtonDown;
+ if (_imageMain != null)
+ {
+ var t = new RotateTransform();
+ BindingOperations.SetBinding(t, RotateTransform.AngleProperty, new Binding(ImageRotateProperty.Name) {Source = this});
+ _imageMain.LayoutTransform = t;
+ _imageMain.MouseLeftButtonDown += ImageMain_OnMouseLeftButtonDown;
+ }
if (_canvasSmallImg != null)
{
@@ -410,11 +426,11 @@ namespace HandyControl.Controls
private static void OnImageScaleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
- if (d is ImageViewer ImageViewer && e.NewValue is double newValue)
+ if (d is ImageViewer imageViewer && e.NewValue is double newValue)
{
- ImageViewer.ImageWidth = ImageViewer.ImageOriWidth * newValue;
- ImageViewer.ImageHeight = ImageViewer.ImageOriHeight * newValue;
- ImageViewer.ScaleStr = $"{newValue * 100:#0}%";
+ imageViewer.ImageWidth = imageViewer.ImageOriWidth * newValue;
+ imageViewer.ImageHeight = imageViewer.ImageOriHeight * newValue;
+ imageViewer.ScaleStr = $"{newValue * 100:#0}%";
}
}
diff --git a/HandyControl/Controls/ScrollViewer.cs b/HandyControl/Controls/ScrollViewer.cs
index b024d360..a2fdaccd 100644
--- a/HandyControl/Controls/ScrollViewer.cs
+++ b/HandyControl/Controls/ScrollViewer.cs
@@ -201,7 +201,6 @@ namespace HandyControl.Controls
if (d is ScrollViewer ctl && e.NewValue is double v)
{
ctl.ScrollToHorizontalOffset(v);
- Console.WriteLine(v);
}
}
diff --git a/HandyControl/Expression/Shapes/Arc.cs b/HandyControl/Expression/Shapes/Arc.cs
index 7f34b945..ef9e0f00 100644
--- a/HandyControl/Expression/Shapes/Arc.cs
+++ b/HandyControl/Expression/Shapes/Arc.cs
@@ -24,22 +24,19 @@ namespace HandyControl.Expression.Shapes
public double ArcThickness
{
- get =>
- (double) GetValue(ArcThicknessProperty);
+ get => (double) GetValue(ArcThicknessProperty);
set => SetValue(ArcThicknessProperty, value);
}
public UnitType ArcThicknessUnit
{
- get =>
- (UnitType) GetValue(ArcThicknessUnitProperty);
+ get => (UnitType) GetValue(ArcThicknessUnitProperty);
set => SetValue(ArcThicknessUnitProperty, value);
}
public double EndAngle
{
- get =>
- (double) GetValue(EndAngleProperty);
+ get => (double) GetValue(EndAngleProperty);
set => SetValue(EndAngleProperty, value);
}
@@ -51,8 +48,7 @@ namespace HandyControl.Expression.Shapes
public double StartAngle
{
- get =>
- (double) GetValue(StartAngleProperty);
+ get => (double) GetValue(StartAngleProperty);
set => SetValue(StartAngleProperty, value);
}
diff --git a/HandyControl/Themes/Styles/ImageViewer.xaml b/HandyControl/Themes/Styles/ImageViewer.xaml
index 016ce182..fac2c558 100644
--- a/HandyControl/Themes/Styles/ImageViewer.xaml
+++ b/HandyControl/Themes/Styles/ImageViewer.xaml
@@ -29,11 +29,7 @@
-
-
-
-
-
+
@@ -73,7 +69,7 @@
-
+
diff --git a/HandyControlDemo/HandyControlDemo.csproj b/HandyControlDemo/HandyControlDemo.csproj
index 446b5e9c..35354266 100644
--- a/HandyControlDemo/HandyControlDemo.csproj
+++ b/HandyControlDemo/HandyControlDemo.csproj
@@ -236,6 +236,7 @@
+
diff --git a/HandyControlDemo/Service/DataService.cs b/HandyControlDemo/Service/DataService.cs
index 8f8ee1a4..c3752620 100644
--- a/HandyControlDemo/Service/DataService.cs
+++ b/HandyControlDemo/Service/DataService.cs
@@ -43,6 +43,27 @@ namespace HandyControlDemo.Service
return list;
}
+ public List GetDemoDataList(int count)
+ {
+ var list = new List();
+ for (var i = 1; i <= count; i++)
+ {
+ var index = i % 6 + 1;
+ var model = new DemoDataModel
+ {
+ Index = i,
+ IsSelected = i % 2 == 0,
+ Name = $"Name{i}",
+ Type = (DemoType)index,
+ ImgPath = $"/HandyControlDemo;component/Resources/Img/Avatar/avatar{index}.png",
+ Remark = new string(i.ToString()[0], 10)
+ };
+ list.Add(model);
+ }
+
+ return list;
+ }
+
internal List GetComboBoxDemoDataList()
{
var converter = new StringRepeatConverter();
diff --git a/HandyControlDemo/UserControl/Controls/PaginationDemoCtl.xaml b/HandyControlDemo/UserControl/Controls/PaginationDemoCtl.xaml
index bd510cf9..7e6ad9fb 100644
--- a/HandyControlDemo/UserControl/Controls/PaginationDemoCtl.xaml
+++ b/HandyControlDemo/UserControl/Controls/PaginationDemoCtl.xaml
@@ -2,8 +2,44 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Background="{DynamicResource RegionBrush}"
- xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl">
+ DataContext="{Binding PaginationDemo,Source={StaticResource Locator}}"
+ xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
+ xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
+ xmlns:i="clr-namespace:HandyControl.Interactivity;assembly=HandyControl">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/HandyControlDemo/ViewModel/PaginationDemoViewModel.cs b/HandyControlDemo/ViewModel/PaginationDemoViewModel.cs
new file mode 100644
index 00000000..f1f9aeb6
--- /dev/null
+++ b/HandyControlDemo/ViewModel/PaginationDemoViewModel.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.CommandWpf;
+using HandyControl.Data;
+using HandyControlDemo.Data;
+using HandyControlDemo.Service;
+
+namespace HandyControlDemo.ViewModel
+{
+ public class PaginationDemoViewModel : ViewModelBase
+ {
+ ///
+ /// 所有数据
+ ///
+ private readonly List _totalDataList;
+
+ ///
+ /// 显示的数据
+ ///
+ private List _dataList;
+
+ ///
+ /// 显示的数据
+ ///
+ public List DataList
+ {
+ get => _dataList;
+ set => Set(ref _dataList, value);
+ }
+
+ ///
+ /// 页码
+ ///
+ private int _pageIndex = 1;
+
+ ///
+ /// 页码
+ ///
+ public int PageIndex
+ {
+ get => _pageIndex;
+ set => Set(ref _pageIndex, value);
+ }
+
+ public PaginationDemoViewModel(DataService dataService)
+ {
+ _totalDataList = dataService.GetDemoDataList(100);
+ DataList = _totalDataList.Take(10).ToList();
+ }
+
+ ///
+ /// 页码改变命令
+ ///
+ public RelayCommand> PageUpdatedCmd =>
+ new Lazy>>(() =>
+ new RelayCommand>(PageUpdated)).Value;
+
+ ///
+ /// 页码改变
+ ///
+ private void PageUpdated(FunctionEventArgs info)
+ {
+ DataList = _totalDataList.Skip((info.Info - 1) * 10).Take(10).ToList();
+ }
+ }
+}
\ No newline at end of file
diff --git a/HandyControlDemo/ViewModel/ViewModelLocator.cs b/HandyControlDemo/ViewModel/ViewModelLocator.cs
index 88943f11..9e7d5c0e 100644
--- a/HandyControlDemo/ViewModel/ViewModelLocator.cs
+++ b/HandyControlDemo/ViewModel/ViewModelLocator.cs
@@ -21,6 +21,7 @@ namespace HandyControlDemo.ViewModel
SimpleIoc.Default.Register();
SimpleIoc.Default.Register();
SimpleIoc.Default.Register();
+ SimpleIoc.Default.Register();
}
public static ViewModelLocator Instance => new Lazy(() =>
@@ -42,6 +43,8 @@ namespace HandyControlDemo.ViewModel
public StepBarDemoViewModel StepBarDemo => ServiceLocator.Current.GetInstance();
+ public PaginationDemoViewModel PaginationDemo => ServiceLocator.Current.GetInstance();
+
#endregion
}
}
\ No newline at end of file