Skip to content

Commit 889c1fd

Browse files
committed
Add IsStringNullOrEmptyToVisibleConverter and bind ApplicationName to UI
1 parent ff237f8 commit 889c1fd

File tree

4 files changed

+247
-282
lines changed

4 files changed

+247
-282
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System.Windows.Data;
2+
3+
namespace FlaUInspect.Core.Converters;
4+
5+
public class IsStringNullOrEmptyToVisibleConverter : IValueConverter {
6+
public bool IsInverted { get; set; }
7+
8+
public object Convert(object? value, Type targetType, object? parameter, System.Globalization.CultureInfo culture) {
9+
var str = value as string;
10+
bool condition = string.IsNullOrEmpty(str);
11+
condition = IsInverted ? !condition : condition;
12+
13+
return condition ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible;
14+
}
15+
16+
public object ConvertBack(object? value, Type targetType, object? parameter, System.Globalization.CultureInfo culture) {
17+
throw new NotSupportedException();
18+
}
19+
}

0 commit comments

Comments
 (0)