Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
NullToBooleanConverter.cs
1using System;
2using System.Globalization;
3using Microsoft.Maui.Controls;
4
6{
10 public class NullToBooleanConverter : IValueConverter
11 {
15 public bool Invert { get; set; }
16
18 public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
19 {
20 bool Result = value is not null;
21 return this.Invert ? !Result : Result;
22 }
23
25 public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
26 {
27 throw new NotSupportedException("NullToBooleanConverter does not support ConvertBack.");
28 }
29 }
30}
Converts null references into boolean values, with optional inversion.
object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
bool Invert
Gets or sets a value indicating whether the converter should invert the result.