Refactor StundePage and StundenPage layouts: adjust grid structure, improve margin handling, and enhance visuals with new binding and triggers.
This commit is contained in:
22
Jugenddienst Stunden/Converter/AnyTrueMultiConverter.cs
Normal file
22
Jugenddienst Stunden/Converter/AnyTrueMultiConverter.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.Maui.Controls;
|
||||||
|
|
||||||
|
namespace Jugenddienst_Stunden.Converter;
|
||||||
|
|
||||||
|
public class AnyTrueMultiConverter : IMultiValueConverter {
|
||||||
|
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) {
|
||||||
|
foreach (object value in values) {
|
||||||
|
if (value is bool b && b) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) {
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -24,9 +24,9 @@
|
|||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="50"/>
|
||||||
<RowDefinition Height="180"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="45"/>
|
||||||
<RowDefinition Height="20"/>
|
<RowDefinition Height="20"/>
|
||||||
<RowDefinition Height="40"/>
|
<RowDefinition Height="40"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
<Label Text="{Binding SubTitle}" FontSize="Medium" FontAttributes="Bold" Margin="4,0,0,0" Grid.Row="0" />
|
<Label Text="{Binding SubTitle}" FontSize="Medium" FontAttributes="Bold" Margin="4,0,0,0" Grid.Row="0" />
|
||||||
|
|
||||||
<FlexLayout Direction="Row" AlignItems="Start" Wrap="Wrap" AlignContent="Start" JustifyContent="Start" Grid.Row="1" >
|
<FlexLayout Direction="Row" AlignItems="Start" Wrap="Wrap" AlignContent="Start" JustifyContent="Start" Grid.Row="1" Margin="0,0,0,10" >
|
||||||
|
|
||||||
<Border Margin="0,0,0,10" MinimumHeightRequest="72" FlexLayout.Grow="1">
|
<Border Margin="0,0,0,10" MinimumHeightRequest="72" FlexLayout.Grow="1">
|
||||||
<Border.Padding>
|
<Border.Padding>
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<Editor Placeholder="Beschreibung" Text="{Binding DayTime.Description}" MinimumHeightRequest="40"
|
<Editor Placeholder="Beschreibung" Text="{Binding DayTime.Description}" MinimumHeightRequest="40"
|
||||||
AutoSize="TextChanges" FontSize="18" Grid.Row="2" />
|
AutoSize="TextChanges" FontSize="18" Grid.Row="2" Margin="0,0,0,10" />
|
||||||
|
|
||||||
<Grid ColumnDefinitions="*,*" ColumnSpacing="4" Grid.Row="3">
|
<Grid ColumnDefinitions="*,*" ColumnSpacing="4" Grid.Row="3">
|
||||||
<Button Grid.Column="1" Text="Speichern"
|
<Button Grid.Column="1" Text="Speichern"
|
||||||
@@ -127,7 +127,6 @@
|
|||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<CollectionView
|
<CollectionView
|
||||||
ItemsSource="{Binding DayTimes}"
|
ItemsSource="{Binding DayTimes}"
|
||||||
x:Name="stundeItems" Margin="0"
|
x:Name="stundeItems" Margin="0"
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
<ContentPage.Resources>
|
<ContentPage.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<conv:SecondsTimeConverter x:Key="secToTime" />
|
<conv:SecondsTimeConverter x:Key="secToTime" />
|
||||||
|
<conv:AnyTrueMultiConverter x:Key="AnyTrue"/>
|
||||||
<FontImageSource x:Key="ToolbarIcon"
|
<FontImageSource x:Key="ToolbarIcon"
|
||||||
Glyph="+"
|
Glyph="+"
|
||||||
Size="22"
|
Size="22"
|
||||||
@@ -27,7 +28,7 @@
|
|||||||
</ContentPage.Behaviors>
|
</ContentPage.Behaviors>
|
||||||
|
|
||||||
<ContentPage.ToolbarItems>
|
<ContentPage.ToolbarItems>
|
||||||
<!--<ToolbarItem Text="Lade Liste" Command="{Binding RefreshListCommand}"/>-->
|
|
||||||
<ToolbarItem Text="Neuer Eintrag" IconImageSource="{StaticResource ToolbarIcon}"
|
<ToolbarItem Text="Neuer Eintrag" IconImageSource="{StaticResource ToolbarIcon}"
|
||||||
Command="{Binding NewEntryCommand}" />
|
Command="{Binding NewEntryCommand}" />
|
||||||
</ContentPage.ToolbarItems>
|
</ContentPage.ToolbarItems>
|
||||||
@@ -35,7 +36,6 @@
|
|||||||
<RefreshView x:Name="MyRefreshView" Command="{Binding RefreshCommand}" IsRefreshing="{Binding IsRefreshing}"
|
<RefreshView x:Name="MyRefreshView" Command="{Binding RefreshCommand}" IsRefreshing="{Binding IsRefreshing}"
|
||||||
Margin="10" Padding="10">
|
Margin="10" Padding="10">
|
||||||
<Grid RowDefinitions="50,*,Auto,80">
|
<Grid RowDefinitions="50,*,Auto,80">
|
||||||
<!--<VerticalStackLayout Spacing="10" Margin="10">-->
|
|
||||||
|
|
||||||
<Grid RowDefinitions="Auto" ColumnDefinitions="Auto,*" HeightRequest="50" Grid.Row="0">
|
<Grid RowDefinitions="Auto" ColumnDefinitions="Auto,*" HeightRequest="50" Grid.Row="0">
|
||||||
<DatePicker Grid.Column="0" MinimumDate="{Binding MinimumDate}"
|
<DatePicker Grid.Column="0" MinimumDate="{Binding MinimumDate}"
|
||||||
@@ -53,7 +53,6 @@
|
|||||||
<CollectionView
|
<CollectionView
|
||||||
ItemsSource="{Binding DayTimes}"
|
ItemsSource="{Binding DayTimes}"
|
||||||
x:Name="stundeItems" Margin="0,0,0,20"
|
x:Name="stundeItems" Margin="0,0,0,20"
|
||||||
|
|
||||||
SelectionMode="Single"
|
SelectionMode="Single"
|
||||||
SelectionChangedCommand="{Binding SelectEntryCommand}"
|
SelectionChangedCommand="{Binding SelectEntryCommand}"
|
||||||
SelectionChangedCommandParameter="{Binding Source={RelativeSource Self}, Path=SelectedItem}"
|
SelectionChangedCommandParameter="{Binding Source={RelativeSource Self}, Path=SelectedItem}"
|
||||||
@@ -61,79 +60,83 @@
|
|||||||
Grid.Row="1">
|
Grid.Row="1">
|
||||||
|
|
||||||
<CollectionView.ItemsLayout>
|
<CollectionView.ItemsLayout>
|
||||||
<LinearItemsLayout Orientation="Vertical" ItemSpacing="0" />
|
<LinearItemsLayout Orientation="Vertical" ItemSpacing="10" />
|
||||||
</CollectionView.ItemsLayout>
|
</CollectionView.ItemsLayout>
|
||||||
|
|
||||||
<CollectionView.ItemTemplate>
|
<CollectionView.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<VerticalStackLayout Padding="5,10,5,0">
|
<Border Padding="5" StrokeShape="RoundRectangle 0,30,0,30" >
|
||||||
|
<Border.Triggers>
|
||||||
|
<DataTrigger TargetType="Border" Binding="{Binding Approved}" Value="True">
|
||||||
|
<Setter Property="Background" Value="LightCoral"/>
|
||||||
|
<Setter Property="Padding" Value="4"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Border.Triggers>
|
||||||
|
|
||||||
<VisualStateManager.VisualStateGroups>
|
<VisualStateManager.VisualStateGroups>
|
||||||
<VisualStateGroup Name="CommonStates">
|
<VisualStateGroup Name="CommonStates">
|
||||||
<VisualState Name="Normal">
|
<VisualState Name="Normal">
|
||||||
<VisualState.Setters>
|
<VisualState.Setters>
|
||||||
<Setter Property="BackgroundColor"
|
<Setter Property="BackgroundColor"
|
||||||
Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource TransparentColor}}" />
|
Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource TransparentColor}}" />
|
||||||
</VisualState.Setters>
|
</VisualState.Setters>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
<VisualState Name="Selected">
|
<VisualState Name="Selected">
|
||||||
<VisualState.Setters>
|
<VisualState.Setters>
|
||||||
<Setter Property="BackgroundColor"
|
<Setter Property="BackgroundColor"
|
||||||
Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource PrimaryDark}}" />
|
Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource PrimaryDark}}" />
|
||||||
</VisualState.Setters>
|
</VisualState.Setters>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
</VisualStateGroup>
|
</VisualStateGroup>
|
||||||
</VisualStateManager.VisualStateGroups>
|
</VisualStateManager.VisualStateGroups>
|
||||||
|
|
||||||
|
<Grid RowDefinitions="Auto,Auto,Auto" ColumnDefinitions="*" >
|
||||||
|
|
||||||
<HorizontalStackLayout>
|
<HorizontalStackLayout Grid.Row="0" >
|
||||||
<HorizontalStackLayout.Triggers>
|
<Label Text="{Binding Day, StringFormat='{0:dddd, dd. MMMM}'}" />
|
||||||
<DataTrigger TargetType="HorizontalStackLayout" Binding="{Binding Approved}"
|
<Label Text="von" Padding="5,0,5,0" />
|
||||||
Value="True">
|
<Label Text="{Binding Begin}" />
|
||||||
<Setter Property="BackgroundColor" Value="LightCoral" />
|
<Label Text="bis" Padding="5,0,5,0" />
|
||||||
<Setter Property="Padding" Value="4" />
|
<Label Text="{Binding End}" />
|
||||||
</DataTrigger>
|
</HorizontalStackLayout>
|
||||||
</HorizontalStackLayout.Triggers>
|
|
||||||
<Label Text="{Binding Day, StringFormat='{0:dddd, dd. MMMM}'}" />
|
|
||||||
<Label Text="von" Padding="5,0,5,0" />
|
|
||||||
<Label Text="{Binding Begin}" />
|
|
||||||
<Label Text="bis" Padding="5,0,5,0" />
|
|
||||||
<Label Text="{Binding End}" />
|
|
||||||
</HorizontalStackLayout>
|
|
||||||
|
|
||||||
<HorizontalStackLayout HorizontalOptions="FillAndExpand">
|
<HorizontalStackLayout Grid.Row="1" >
|
||||||
<HorizontalStackLayout.Triggers>
|
<!--<HorizontalStackLayout.IsVisible>
|
||||||
<DataTrigger TargetType="HorizontalStackLayout" Binding="{Binding Approved}"
|
<MultiBinding Converter="{StaticResource AnyTrue}">
|
||||||
Value="True">
|
<Binding Path="Approved"/>
|
||||||
<Setter Property="BackgroundColor" Value="LightCoral" />
|
<Binding Path="BindingContext.GemeindeAktivSet" Source="{RelativeSource AncestorType={x:Type ContentPage}}"/>
|
||||||
<Setter Property="Padding" Value="4" />
|
<Binding Path="BindingContext.ProjektAktivSet" Source="{RelativeSource AncestorType={x:Type ContentPage}}"/>
|
||||||
</DataTrigger>
|
</MultiBinding>
|
||||||
</HorizontalStackLayout.Triggers>
|
</HorizontalStackLayout.IsVisible>-->
|
||||||
<Label Text="{Binding GemeindeAktiv.Name}" Margin="0,0,10,0"
|
<Label Text="{Binding GemeindeAktiv.Name}" Padding="0,0,10,0"
|
||||||
IsVisible="{Binding Source={RelativeSource AncestorType={x:Type ContentPage}}, Path=BindingContext.GemeindeAktivSet}" />
|
IsVisible="{Binding Source={RelativeSource AncestorType={x:Type ContentPage}}, Path=BindingContext.GemeindeAktivSet}" />
|
||||||
<Label Text="{Binding ProjektAktiv.Name}" Margin="0,0,10,0"
|
<Label Text="{Binding ProjektAktiv.Name}" Padding="0,0,10,0"
|
||||||
IsVisible="{Binding Source={RelativeSource AncestorType={x:Type ContentPage}}, Path=BindingContext.ProjektAktivSet}" />
|
IsVisible="{Binding Source={RelativeSource AncestorType={x:Type ContentPage}}, Path=BindingContext.ProjektAktivSet}" />
|
||||||
<Label Text="{Binding FreistellungAktiv.Name}" IsVisible="{Binding Approved}" />
|
<Label Text="{Binding FreistellungAktiv.Name}" IsVisible="{Binding Approved}" />
|
||||||
</HorizontalStackLayout>
|
</HorizontalStackLayout>
|
||||||
|
|
||||||
|
<!-- Ensure description row does not paint background -->
|
||||||
|
<Label Text="{Binding Description}" Grid.Row="2" />
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
<Label Text="{Binding Description}" Padding="0,0,0,15" />
|
|
||||||
</VerticalStackLayout>
|
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</CollectionView.ItemTemplate>
|
</CollectionView.ItemTemplate>
|
||||||
|
|
||||||
</CollectionView>
|
</CollectionView>
|
||||||
|
|
||||||
<!--<BoxView HeightRequest="1" Grid.Row="2" Margin="0,5,0,15" />-->
|
|
||||||
<Button Text="{Binding LoadOverview}"
|
<Button Text="{Binding LoadOverview}"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Command="{Binding LoadDataCommand}"
|
Command="{Binding LoadDataCommand}"
|
||||||
TextColor="{AppThemeBinding Dark={StaticResource White}, Light={StaticResource White}}" />
|
TextColor="{AppThemeBinding Dark={StaticResource White}, Light={StaticResource White}}" />
|
||||||
<Border Padding="2" Grid.Row="3" Margin="0,10,0,0">
|
<Border Padding="2" Grid.Row="3" Margin="0,10,0,0">
|
||||||
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,*" ColumnDefinitions="Auto,Auto,*,Auto" Margin="10,2">
|
<Grid RowDefinitions="Auto,Auto,Auto" ColumnDefinitions="Auto,Auto,*" Margin="10,2">
|
||||||
<Label Grid.Row="0" Text="Soll:" />
|
<Label Grid.Row="0" Text="Soll:" />
|
||||||
<Label Grid.Row="1" Text="Summe:" />
|
<Label Grid.Row="1" Text="Summe:" />
|
||||||
<Label Grid.Row="2" Text="Differenz:" Margin="0,0,15,0" />
|
<Label Grid.Row="2" Text="Differenz:" Margin="0,0,15,0" />
|
||||||
<!--<BoxView Grid.Row="3" Grid.ColumnSpan="4" HeightRequest="1" Color="LightGrey" Margin="0,5"/>-->
|
|
||||||
<Label Grid.Row="0" Grid.Column="2" Text="Restüberstunden:" Margin="15,0,0,0" />
|
<Label Grid.Row="0" Grid.Column="2" Text="Restüberstunden:" Margin="15,0,0,0" />
|
||||||
<Label Grid.Row="1" Grid.Column="2" Text="Zeitausgleich:" Margin="15,0,0,0" />
|
<Label Grid.Row="1" Grid.Column="2" Text="Zeitausgleich:" Margin="15,0,0,0" />
|
||||||
<Label Grid.Row="2" Grid.Column="2" Text="Resturlaub:" Margin="15,0,0,0" />
|
<Label Grid.Row="2" Grid.Column="2" Text="Resturlaub:" Margin="15,0,0,0" />
|
||||||
@@ -156,7 +159,7 @@
|
|||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<!--</VerticalStackLayout>-->
|
|
||||||
|
|
||||||
</RefreshView>
|
</RefreshView>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
Reference in New Issue
Block a user