bloxstrap/Bloxstrap/UI/Converters/RangeConverter.cs
2024-06-08 20:49:26 +01:00

30 lines
736 B
C#

using System.Windows.Data;
namespace Bloxstrap.UI.Converters
{
internal class RangeConverter : IValueConverter
{
public int? From { get; set; }
public int? To { get; set; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
int numvalue = (int)value;
if (From is null)
return numvalue < To;
if (To is null)
return numvalue > From;
return numvalue > From && numvalue < To;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}