From 0440c722a221b8068bbf388c1c0c51f0faff0451 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 14:17:46 -0300 Subject: some dlls --- .../ZeroToVisibilityInvertedConverter.cs | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Gestor.Common/Gestor.Common.Converters/ZeroToVisibilityInvertedConverter.cs (limited to 'Gestor.Common/Gestor.Common.Converters/ZeroToVisibilityInvertedConverter.cs') diff --git a/Gestor.Common/Gestor.Common.Converters/ZeroToVisibilityInvertedConverter.cs b/Gestor.Common/Gestor.Common.Converters/ZeroToVisibilityInvertedConverter.cs new file mode 100644 index 0000000..3680fcc --- /dev/null +++ b/Gestor.Common/Gestor.Common.Converters/ZeroToVisibilityInvertedConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Gestor.Common.Converters; + +public class ZeroToVisibilityInvertedConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return (object)(Visibility)((value != null && (int)Math.Round(double.Parse(value.ToString())) != 0) ? 2 : 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return (value != null && !string.IsNullOrEmpty(value.ToString())) ? int.Parse(value.ToString()) : 0; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} -- cgit v1.2.3