summaryrefslogtreecommitdiff
path: root/Gestor.Common/Gestor.Common.Converters/NegativoColorConverter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Common/Gestor.Common.Converters/NegativoColorConverter.cs')
-rw-r--r--Gestor.Common/Gestor.Common.Converters/NegativoColorConverter.cs42
1 files changed, 42 insertions, 0 deletions
diff --git a/Gestor.Common/Gestor.Common.Converters/NegativoColorConverter.cs b/Gestor.Common/Gestor.Common.Converters/NegativoColorConverter.cs
new file mode 100644
index 0000000..9c7abf7
--- /dev/null
+++ b/Gestor.Common/Gestor.Common.Converters/NegativoColorConverter.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Markup;
+using System.Windows.Media;
+
+namespace Gestor.Common.Converters;
+
+public class NegativoColorConverter : MarkupExtension, IValueConverter
+{
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ //IL_0010: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0015: Unknown result type (might be due to invalid IL or missing references)
+ //IL_001b: Expected O, but got Unknown
+ //IL_0038: Unknown result type (might be due to invalid IL or missing references)
+ //IL_003d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0043: Expected O, but got Unknown
+ //IL_002d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0032: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0038: Expected O, but got Unknown
+ if (value != null && !string.IsNullOrEmpty(value.ToString()))
+ {
+ if (value.ToString().Contains("-"))
+ {
+ return (object)new SolidColorBrush(Colors.Red);
+ }
+ return (object)new SolidColorBrush(Colors.Black);
+ }
+ return (object)new SolidColorBrush(Colors.Black);
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return null;
+ }
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return this;
+ }
+}