init
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace DTS.Common.Converters
|
||||
{
|
||||
/// <summary>
|
||||
/// converts between two values and a bool (a >= b)
|
||||
/// currently only handles two ints or two doubles
|
||||
/// </summary>
|
||||
public class IntervalToVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
var on = false;
|
||||
if (value is int a && parameter is int b)
|
||||
{
|
||||
on = a >= b;
|
||||
}
|
||||
if (value is double dA && parameter is double dB)
|
||||
{
|
||||
on = dA >= dB;
|
||||
}
|
||||
if (value is ushort uShortA && parameter is ushort uShortB)
|
||||
{
|
||||
on = uShortA >= uShortB;
|
||||
}
|
||||
return on ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user