You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mchsamples-wpf-dotnet/ex_TextBox_PlaceHolder/Bool2VisibilityConverter.cs

31 lines
797 B

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows;
using System.Windows.Data;
namespace ex_TextBox_PlaceHolder
{
class Bool2VisibilityConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
bool isEmpty = (bool)values[0];
bool hasFocus = (bool)values[1];
if(!isEmpty || hasFocus)
{
return Visibility.Collapsed;
}
return Visibility.Visible;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}