Files
sms-task-two/src/Sms.TaskTwo.Wpf/Converters/StringNotEmptyToVisibilityConverter.cs
2026-06-04 22:02:15 +03:00

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();
}