17 lines
574 B
C#
17 lines
574 B
C#
using System.Globalization;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace Sms.TaskTwo.Wpf.Converters;
|
|
|
|
public sealed class StringNotEmptyToVisibilityConverter : IValueConverter
|
|
{
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) =>
|
|
value is string text && !string.IsNullOrEmpty(text)
|
|
? Visibility.Visible
|
|
: Visibility.Collapsed;
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) =>
|
|
throw new NotSupportedException();
|
|
}
|