Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
OnlyShowNonEmpty.cs
1using System.Globalization;
2
4{
8 public class OnlyShowNonEmpty : IValueConverter, IMarkupExtension
9 {
11 public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
12 {
13 if (value is string s)
14 return !string.IsNullOrEmpty(s);
15 else if (value is bool b)
16 return b;
17 else
18 return value is not null;
19 }
20
22 public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
23 {
24 return value?.ToString() ?? string.Empty;
25 }
26
28 public object ProvideValue(IServiceProvider serviceProvider)
29 {
30 return this;
31 }
32 }
33}
Is true if a property is non-empty.
object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
object ProvideValue(IServiceProvider serviceProvider)