From 40bbc0ddb058ba6136fa4b99be237a9862c9e67a Mon Sep 17 00:00:00 2001 From: JSY Date: Thu, 19 Sep 2019 00:16:52 +0800 Subject: [PATCH] fxi --- .../KGToBooleanConverter.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/GeothermalResearchInstitute/GeothermalResearchInstitute.Wpf/KGToBooleanConverter.cs b/GeothermalResearchInstitute/GeothermalResearchInstitute.Wpf/KGToBooleanConverter.cs index bd3d9d49..f69d6512 100644 --- a/GeothermalResearchInstitute/GeothermalResearchInstitute.Wpf/KGToBooleanConverter.cs +++ b/GeothermalResearchInstitute/GeothermalResearchInstitute.Wpf/KGToBooleanConverter.cs @@ -14,6 +14,18 @@ public class KGToBooleanConverter : IValueConverter { public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { + if (value is bool) + { + if ((bool)value == true) + { + return "开"; + } + else + { + return "关"; + } + } + switch (value.ToString()) { case "开": @@ -41,6 +53,16 @@ public object Convert(object value, Type targetType, object parameter, CultureIn } } + switch (value.ToString()) + { + case "开": + return true; + case "关": + return false; + default: + break; + } + throw new NotImplementedException(); } }