diff --git a/ENI2/DetailViewControls/OverViewDetailControl.xaml b/ENI2/DetailViewControls/OverViewDetailControl.xaml index bb384509..8a06b9d0 100644 --- a/ENI2/DetailViewControls/OverViewDetailControl.xaml +++ b/ENI2/DetailViewControls/OverViewDetailControl.xaml @@ -8,6 +8,7 @@ xmlns:enictrl="clr-namespace:ENI2.Controls" xmlns:p="clr-namespace:ENI2.Properties" xmlns:util="clr-namespace:ENI2.Util" + xmlns:data="clr-namespace:bsmd.database;assembly=bsmd.database" xmlns:local="clr-namespace:ENI2.DetailViewControls" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="800"> @@ -147,6 +148,13 @@ + + + + + + + @@ -160,10 +168,7 @@ - - + diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index 1cc369c0..544d357d 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -436,6 +436,7 @@ + diff --git a/ENI2/Util/CutoffConverter.cs b/ENI2/Util/CutoffConverter.cs new file mode 100644 index 00000000..b19c5570 --- /dev/null +++ b/ENI2/Util/CutoffConverter.cs @@ -0,0 +1,49 @@ +// Copyright (c) 2023- schick Informatik +// Description: Simple converter to check if a numeric value is greater than a specific value. This can +// be used by datatriggers in XAML +// + +using System; +using System.Collections; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; + +namespace ENI2.Util +{ + public class CutoffConverter : MarkupExtension, IValueConverter + { + + #region MarkupExtension implementation + + private static CutoffConverter _converter = null; + public override object ProvideValue(IServiceProvider serviceProvider) + { + if (_converter == null) + { + _converter = new CutoffConverter(); + } + return _converter; + } + + #endregion + + #region IValueConverter implementation + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is ICollection collection) + return collection.Count > Cutoff; + return ((int)value) > Cutoff; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + + #endregion + + public int Cutoff { get; set; } + } +}