2021-12-06 17:54:46 +01:00
|
|
|
using System;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
#if WINUI
|
|
|
|
|
using Microsoft.UI.Xaml;
|
|
|
|
|
using Microsoft.UI.Xaml.Data;
|
|
|
|
|
#elif UWP
|
|
|
|
|
using Windows.UI.Xaml;
|
|
|
|
|
using Windows.UI.Xaml.Data;
|
|
|
|
|
#else
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
namespace SampleApplication
|
|
|
|
|
{
|
2022-08-05 18:54:19 +02:00
|
|
|
public class DoubleToVisibilityConverter : IValueConverter
|
2021-12-06 17:54:46 +01:00
|
|
|
{
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, string language)
|
|
|
|
|
{
|
2022-08-05 18:54:19 +02:00
|
|
|
if (!(parameter is double p))
|
|
|
|
|
{
|
|
|
|
|
p = double.Parse(parameter.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//System.Diagnostics.Debug.WriteLine((double)value);
|
|
|
|
|
|
|
|
|
|
return (double)value != p ? Visibility.Visible : Visibility.Collapsed;
|
2021-12-06 17:54:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
return Convert(value, targetType, parameter, "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
return ConvertBack(value, targetType, parameter, "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|