add SplitButtonItem

This commit is contained in:
NaBian committed 2019-09-05 00:14:50 +08:00
1 parent a54fc69869
commit 1b49c516c3
8 files changed
+141 -36

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();
}
}
}