Merge pull request #172 from HandyOrg/add-SplitButton

Add split button
This commit is contained in:
NaBian authored and GitHub committed 2019-09-17 00:50:13 +08:00
commit 1cc89b2849
44 files changed
+524 -92

No files matched your search

@@ -0,0 +1,33 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace HandyControl.Tools.Converter
{
public class CornerRadiusSplitConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is CornerRadius cornerRadius)
{
if (parameter is string str)
{
var arr = str.Split(',');
if (arr.Length != 4) return cornerRadius;
return new CornerRadius(arr[0].Equals("1") ? cornerRadius.TopLeft : 0,
arr[1].Equals("1") ? cornerRadius.TopRight : 0,
arr[1].Equals("1") ? cornerRadius.BottomRight : 0,
arr[1].Equals("1") ? cornerRadius.BottomLeft : 0);
}
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,33 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace HandyControl.Tools.Converter
{
public class ThicknessSplitConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is Thickness cornerRadius)
{
if (parameter is string str)
{
var arr = str.Split(',');
if (arr.Length != 4) return cornerRadius;
return new CornerRadius(arr[0].Equals("1") ? cornerRadius.Left : 0,
arr[1].Equals("1") ? cornerRadius.Top : 0,
arr[1].Equals("1") ? cornerRadius.Right : 0,
arr[1].Equals("1") ? cornerRadius.Bottom : 0);
}
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}