Converter + ValueConverterGroup

This commit is contained in:
2024-08-14 19:02:17 +02:00
parent 70c13645e5
commit bb5f5700d8
7 changed files with 98 additions and 3 deletions

View File

@@ -848,6 +848,8 @@
<Compile Include="Converter\AnonymizationRight2VisibilityConverter.cs" />
<Compile Include="Converter\BoolNullCheckConverter.cs" />
<Compile Include="Converter\BoolReverseConverter.cs" />
<Compile Include="Converter\BoolEnabledToTabitemBackgroundConverter.cs" />
<Compile Include="Converter\BoolToParameterReturnConverter.cs" />
<Compile Include="Converter\CellColorConverter.cs" />
<Compile Include="Converter\CollectionContainsTag2BoolConverter.cs" />
<Compile Include="Converter\CollectionCountToBoolConverter.cs" />
@@ -868,6 +870,7 @@
<Compile Include="Converter\Rights2DefaultBooleanConverter.cs" />
<Compile Include="Converter\StringLengthVisibilityConverter.cs" />
<Compile Include="Converter\StringLengthVisibilityMultiConverter.cs" />
<Compile Include="Converter\ValueConverterGroup.cs" />
<Compile Include="Core\AutoLockUI.cs" />
<Compile Include="Core\BeWoUtils.cs" />
<Compile Include="Core\BeWoWebClient.cs">

View File

@@ -62,6 +62,12 @@
<conv:ReactivationRight2VisibilityConverter x:Key="ReactivationRight2VisibilityConverter" />
<conv:ArchiveRight2VisibilityConverter x:Key="ArchiveRight2VisibilityConverter" />
<conv:BoolReverseConverter x:Key="BoolReverseConverter" />
<conv:BoolEnabledToTabitemBackgroundConverter x:Key="BoolEnabledToTabitemBackgroundConverter" />
<conv:ValueConverterGroup x:Key="IsNewToTabitemBackground">
<conv:BoolReverseConverter/>
<conv:BoolEnabledToTabitemBackgroundConverter/>
</conv:ValueConverterGroup>
<conv:BoolToParameterReturnConverter x:Key="IsNewToTooltip"/>
<conv:IndividualGoalMassnahmeUncheckPreventConverter x:Key="IndividualGoalMassnahmeUncheckPreventConverter" />
<conv:Rights2DefaultBooleanConverter x:Key="Rights2DefaultBooleanConverter"/>
<conv:CollectionCountToVisibilityConverter x:Key="CollectionCountToVisibilityConverter" />

View File

@@ -0,0 +1,25 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace BeWo.Converter
{
public class BoolEnabledToTabitemBackgroundConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{
return Application.Current.Resources["TabItemTextBrush"];
}
return (bool)value ? Application.Current.Resources["TabItemTextBrush"] : Application.Current.Resources["TabItemTextBrushDisabled"];
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace BeWo.Converter
{
public class BoolToParameterReturnConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{
return null;
}
return (bool)value ? parameter : null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace BeWo.Converter
{
public class ValueConverterGroup : List<IValueConverter>, IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return this.Aggregate(value, (current, converter) => converter.Convert(current, targetType, parameter, culture));
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@@ -3277,6 +3277,7 @@
<!-- Region Edit Tab Control -->
<SolidColorBrush x:Key="TabItemSelectedTextBrush" Color="#FF232323" />
<SolidColorBrush x:Key="TabItemTextBrush" Color="#FF27566A" />
<SolidColorBrush x:Key="TabItemTextBrushDisabled" Color="#FF6A828C" />
<SolidColorBrush x:Key="TabItemHotTextBrush" Color="#FFAB4A07" />
<Style x:Key="ObjectEditTabItemStyle" TargetType="{x:Type TabItem}">

View File

@@ -360,7 +360,12 @@
</GroupBox>
</Grid>
</TabItem>
<TabItem Header="{t:Translate Wohneinheit}" x:Name="tabitem_wohneinheit" Visibility="{Binding Path=PermissionWohneinheitTabitemView, Converter={StaticResource BoolVisibilityConverter}}">
<TabItem Header="{t:Translate Wohneinheit}" x:Name="tabitem_wohneinheit" Visibility="{Binding Path=PermissionWohneinheitTabitemView, Converter={StaticResource BoolVisibilityConverter}}"
IsEnabled="{Binding Path=IsNew, Converter={StaticResource BoolReverseConverter}}"
ToolTip="{Binding Path=IsNew, Converter={StaticResource IsNewToTooltip}, ConverterParameter='Sie müssen zuerst das Wohnheim speichern'}"
Foreground="{Binding Path=IsNew, Converter={StaticResource IsNewToTabitemBackground}}"
ToolTipService.ShowOnDisabled="True"
>
<TabControl x:Name="root_wohneinheit" Grid.Row="1" Style="{StaticResource ObjectEditTabControl}" BorderThickness="0,0,0,0" Padding="0" Margin="-15">
<TabItem Header="{t:Translate Verwaltung}" Visibility="{Binding Path=PermissionWohneinheitView, Converter={StaticResource BoolVisibilityConverter}}">
<Grid>
@@ -528,7 +533,7 @@
ShowDateNavigationPanel="False"
PopupMenuShowing="scheduler_buchungsplan_PopupMenuShowing"
ActiveViewChanged="scheduler_ActiveViewChanged"
ActiveViewIndex="1" DependencyPropertyChanged="scheduler_buchungsplan_DependencyPropertyChanged"
ActiveViewIndex="1" DependencyPropertyChanged="scheduler_buchungsplan_DependencyPropertyChanged" AllowAppointmentCopy="False" AllowAppointmentCreate="False" AllowAppointmentDelete="False" AllowAppointmentDrag="False" AllowAppointmentDragBetweenResources="False" AllowAppointmentEdit="False" AllowAppointmentMultiSelect="False" AllowAppointmentResize="False" AllowCellMultiSelect="False" AllowInplaceEditor="False" AllowReminders="False" AllowAppointmentConflicts="False"
>
<!--<dxsch:TimelineView x:Name="timelineView" ViewMode="Standard" Style="{StaticResource timelineView.Style}"/>-->
<dxsch:TimelineView x:Name="timelineViewYear" ViewMode="Standard" Style="{StaticResource timelineView.Style}"/>
@@ -557,7 +562,8 @@
Start="StartDate"
End="EndDateDisplay"
ResourceId="Wohneinheit.Oid"
LabelId="Customer.CustomerOid"/>
LabelId="Customer.CustomerOid"
Subject="Customer.VollerName"/>
</dxsch:DataSource.AppointmentMappings>
</dxsch:DataSource>
</dxsch:SchedulerControl.DataSource>