33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
using System;
|
|
using System.Windows.Data;
|
|
using System.Globalization;
|
|
using System.Windows;
|
|
|
|
namespace XLIMS.MVVM.Converters
|
|
{
|
|
[ValueConversion(typeof(string), typeof(Visibility))]
|
|
public class VisibilityConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (value != null)
|
|
{
|
|
return Visibility.Visible;
|
|
//string s = value.ToString();
|
|
//object s1 = value;
|
|
//if (s1 is decimal)
|
|
// if ((decimal.Parse(s1.ToString())) == 0) return Visibility.Collapsed;
|
|
//if (s1 is bool)
|
|
// if ((bool.Parse(s1.ToString())) == false) return Visibility.Collapsed;
|
|
//if (string.IsNullOrEmpty(s)) return Visibility.Collapsed;
|
|
}
|
|
return Visibility.Collapsed;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
return value;
|
|
}
|
|
}
|
|
}
|