Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
TransparentIfNull.cs
1using System.Globalization;
3
5{
9 public class TransparentIfNull : IValueConverter, IMarkupExtension
10 {
12 public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
13 {
14 if (value is null)
15 return Colors.Transparent;
16
17 try
18 {
19 string Key = SettingsViewModel.CurrentDisplayMode == AppTheme.Light ? "NormalEditForegroundLight" : "NormalEditForegroundDark";
20 if (!(App.Current?.Resources.TryGetValue(Key, out object Obj) ?? false))
21 return Colors.Transparent;
22
23 if (Obj is Color Color)
24 return Color;
25 else
26 return Colors.Transparent;
27 }
28 catch (Exception)
29 {
30 return Colors.Transparent;
31 }
32 }
33
35 public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
36 {
37 return value;
38 }
39
41 public object ProvideValue(IServiceProvider serviceProvider)
42 {
43 return this;
44 }
45 }
46}
The Application class, representing an instance of the Neuro-Access app.
Definition: App.xaml.cs:69
static new? App Current
Gets the current application, type casted to App.
Definition: App.xaml.cs:99
Transparent color, if value is null.
object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
object ProvideValue(IServiceProvider serviceProvider)