PIbd-42_Kashin_M.I_CPO_Cour.../View/TextBoxPlaceholderConverter.cs

27 lines
812 B
C#

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows;
namespace EmployeeManager.View
{
public class TextBoxPlaceholderConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
string text = values[0] as string;
bool isFocused = (bool)values[1];
return string.IsNullOrEmpty(text) && !isFocused ? Visibility.Visible : Visibility.Collapsed;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}