Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
HyphenIfEmpty.cs
1using System.Globalization;
2
4{
8 [AcceptEmptyServiceProvider]
9 public class HyphenIfEmpty : IValueConverter, IMarkupExtension
10 {
12 public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
13 {
14 if (value is string s && string.IsNullOrEmpty(s))
15 return "-";
16 else
17 return value ?? "-";
18 }
19
21 public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
22 {
23 return value ?? string.Empty;
24 }
25
27 public object ProvideValue(IServiceProvider serviceProvider)
28 {
29 return this;
30 }
31 }
32}
The Localized String corresponding to "N/A" if empty.
object ProvideValue(IServiceProvider serviceProvider)
object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)