blob: c04e32019b70b1bafc8536d1955a81d52b2e7fe5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
public class TextFieldHintVisibilityConverter : IValueConverter
{
public Visibility IsEmptyValue { get; set; } = Visibility.Visible;
public Visibility IsNotEmptyValue { get; set; } = Visibility.Hidden;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return string.IsNullOrEmpty((value ?? "").ToString()) ? IsEmptyValue : IsNotEmptyValue;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return Binding.DoNothing;
}
}
}
|