You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
853 B
C#
29 lines
853 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Data;
|
|
using Txgy.EWS.Client.Common.Enums;
|
|
|
|
namespace Txgy.EWS.Client.Common.Converters
|
|
{
|
|
/// <summary>
|
|
/// 枚举值转Bool值
|
|
/// </summary>
|
|
[ValueConversion(typeof(SelectSort), typeof(Boolean))]
|
|
public class EnumToCheckedConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
return (value.ToString() == parameter.ToString());
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
return (bool)value ? Enum.Parse(targetType, parameter.ToString(), true) : null;
|
|
}
|
|
}
|
|
}
|