Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
NotBooleanToVisibility.cs
1using System;
2using System.Globalization;
3using System.Windows;
4using System.Windows.Data;
5using System.Windows.Markup;
6
8{
12 public class NotBooleanToVisibility : MarkupExtension, IValueConverter
13 {
15 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
16 {
17 if (value is bool b)
18 return !b ? Visibility.Visible : Visibility.Collapsed;
19 else
20 return Visibility.Visible;
21 }
22
24 public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
25 {
26 if (value is Visibility v)
27 return v != Visibility.Visible;
28 else
29 return true;
30 }
31
33 public override object ProvideValue(IServiceProvider serviceProvider)
34 {
35 return this;
36 }
37 }
38}