HuNan_NOSqlSugar/DM_Weight/Converter/InputQuantityConverter.cs

30 lines
971 B
C#
Raw Normal View History

2024-07-06 10:01:30 +08:00
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace DM_Weight.Converter
{
public class InputQuantityConverter : IValueConverter
{
public bool ReadOnlyValue { get; set; } = true;
public bool NotReadOnlyValue { get; set; } = false;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
int iResult;
int.TryParse(value.ToString(), out iResult);
//return int.Parse(value.ToString()) == 2 || int.Parse(value.ToString()) == 6 ? ReadOnlyValue : NotReadOnlyValue;
return iResult == 2 || iResult == 6 ? ReadOnlyValue : NotReadOnlyValue;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return Binding.DoNothing;
}
}
}