添加项目文件。

This commit is contained in:
GG Z
2024-09-22 11:05:41 +08:00
parent fb5d55723a
commit 49ceaae6a8
764 changed files with 78850 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;
using Wpf.Ui.Controls;
namespace Wpf.Ui.Extend.Converters;
public class StringToColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value.ToString();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
string str = value.ToString();
Regex regex = new Regex("^#(?:[0-9a-fA-F]{3}){1,2}$");
if (regex.IsMatch(str))
{
var color = ColorConverter.ConvertFromString(str);
return color;
}
return Binding.DoNothing;
}
}
/// <summary>
/// 判断值是否为空
/// </summary>
public class StringIsEmptyConverter : IValueConverter
{
#region IValueConverter
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return string.IsNullOrEmpty(System.Convert.ToString(value));
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
#endregion
}