Variable Höhe der Stundenliste

This commit is contained in:
2024-10-14 11:30:51 +02:00
parent e4d3fb2d82
commit 17be817e23
6 changed files with 23 additions and 7 deletions

View File

@@ -12,7 +12,7 @@
<!-- Add an item to the toolbar -->
<ContentPage.ToolbarItems>
<ToolbarItem Text="Add" Command="{Binding NewCommand}" IconImageSource="{FontImage Glyph='+', Color=Black, Size=22}" />
<ToolbarItem Text="Neue Notiz" Command="{Binding NewCommand}" IconImageSource="{FontImage Glyph='+', Color=Black, Size=22}" />
</ContentPage.ToolbarItems>
<VerticalStackLayout Margin="20,0,0,0">

View File

@@ -60,7 +60,8 @@ public partial class LoginPage : ContentPage {
Preferences.Default.Set("EmployeeId", int.Parse(op.id));
await DisplayAlert("Login erfolgreich", op.name + " " + op.surname, "OK");
await Navigation.PopAsync();
if (Navigation.NavigationStack.Count > 1)
await Navigation.PopAsync();
} catch (Exception e) {
await DisplayAlert("Fehler", e.Message, "OK");
}

View File

@@ -18,14 +18,14 @@
<ContentPage.ToolbarItems>
<!--<ToolbarItem Text="Lade Liste" Command="{Binding RefreshListCommand}"/>-->
<ToolbarItem Text="Add" IconImageSource="{StaticResource ToolbarIcon}" Command="{Binding NewEntryCommand}" />
<ToolbarItem Text="Neuer Eintrag" IconImageSource="{StaticResource ToolbarIcon}" Command="{Binding NewEntryCommand}" />
</ContentPage.ToolbarItems>
<VerticalStackLayout Spacing="10" Margin="10">
<Grid RowDefinitions="Auto" ColumnDefinitions="Auto,*">
<Grid RowDefinitions="Auto" ColumnDefinitions="Auto,*" HeightRequest="50">
<DatePicker Grid.Column="0" MinimumDate="{Binding MinimumDate}"
MaximumDate="{Binding MaximumDate}"
Date="{Binding DateToday}" Format="dddd, d. MMMM yyyy" />
@@ -37,7 +37,7 @@
<CollectionView
ItemsSource="{Binding DayTimes}"
x:Name="stundeItems" Margin="0"
HeightRequest="350"
HeightRequest="300"
SelectionMode="Single"
SelectionChangedCommand="{Binding SelectEntryCommand}"
SelectionChangedCommandParameter="{Binding Source={RelativeSource Self}, Path=SelectedItem}">
@@ -92,7 +92,7 @@
<BoxView HeightRequest="1" />
<Button Text="{Binding LoadOverview}" Command="{Binding LoadDataCommand}" />
<Frame Padding="2">
<Frame Padding="2" HeightRequest="125">
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,*" ColumnDefinitions="Auto,*" Margin="10,2">
<Label Grid.Row="0" Text="Soll:" />
<Label Grid.Row="1" Text="Summe:" />

View File

@@ -25,6 +25,8 @@ public partial class StundenPage : ContentPage {
//// Berechnen der gew<65>nschten H<>he
//var desiredHeight = screenHeight - 450; // Abz<62>glich der Stunden<65>bersicht
//stundeItems.HeightRequest = desiredHeight;
SizeChanged += OnPageSizeChanged;
}
private void Vm_AlertEvent(object? sender, string e) {
@@ -50,5 +52,13 @@ public partial class StundenPage : ContentPage {
await Navigation.PushAsync(new LoginPage());
}
private void OnPageSizeChanged(object sender, EventArgs e) {
double windowHeight = this.Height;
AdjustLayout(windowHeight);
}
private void AdjustLayout(double height) {
// Passen Sie Ihre UI-Elemente basierend auf der Fensterh<72>he an
stundeItems.HeightRequest = height - 300; //Datepicker Height 50, Monatssummen Height 125, Titel + Navigation Height xyz
}
}