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 public class HyphenIfEmpty : IValueConverter, IMarkupExtension
9 {
11 public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
12 {
13 if (value is string s && string.IsNullOrEmpty(s))
14 return "-";
15 else
16 return value ?? "-";
17 }
18
20 public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
21 {
22 return value ?? string.Empty;
23 }
24
26 public object ProvideValue(IServiceProvider serviceProvider)
27 {
28 return this;
29 }
30 }
31}
The Localized String corresponding to "N/A" if empty.
Definition: HyphenIfEmpty.cs:9
object ProvideValue(IServiceProvider serviceProvider)
object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)