Gelb einfärben der Zeile der Meldeklasse im Overview, wenn PAS und Passagier Anzahl > 0

This commit is contained in:
Daniel Schick 2023-04-06 09:44:38 +02:00
parent 66c96daa92
commit 3010d783f1
3 changed files with 59 additions and 4 deletions

View File

@ -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 @@
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="LightYellow" />
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=Elements, Converter={util:CutoffConverter}, ConverterParameter=0}" Value="True" />
<Condition Binding="{Binding Path=MessageNotificationClass}" Value="{x:Static data:Message+NotificationClass.PAS}" />
</MultiDataTrigger.Conditions>
<Setter Property="Background" Value="Yellow" />
</MultiDataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
@ -160,10 +168,7 @@
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--
<DataGridTextColumn Header="{x:Static p:Resources.textNotificationGroup}" Binding="{Binding ENINotificationDetailGroup}" IsReadOnly="True" Width="0.25*" />
-->
<DataGridTextColumn Header="{x:Static p:Resources.textNotificationClass}" Binding="{Binding MessageNotificationClassDisplay}"
IsReadOnly="True" Width="0.075*" FontWeight="Bold">
<DataGridTextColumn.ElementStyle>

View File

@ -436,6 +436,7 @@
</Compile>
<Compile Include="Util\BoolToVisibilityConverter.cs" />
<Compile Include="Util\ByteConverter.cs" />
<Compile Include="Util\CutoffConverter.cs" />
<Compile Include="Util\DatabaseEntityWatchdog.cs" />
<Compile Include="Util\EnumHelper.cs" />
<Compile Include="Util\EnumToBooleanConverter.cs" />

View File

@ -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; }
}
}