From ebfb58f1a4e7e38864cb43e8cb61dfbf42438ab8 Mon Sep 17 00:00:00 2001 From: Sebastian Hedtrich Date: Wed, 12 Aug 2026 14:19:02 +0200 Subject: [PATCH] Fix BindingError bei Group.IsDifferentiated in GroupDetailView MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Group ist beim ersten Binden der View noch null (LoadGroup läuft erst danach), wodurch der verschachtelte Pfad "Group.IsDifferentiated" bei jeder Navigation einen Binding-Fehler loggte. Stattdessen jetzt eine eigene IsDifferentiated-Property auf GroupDetailViewModel. --- LehrerApp.Desktop/ViewModels/Groups/GroupViewModels.cs | 7 +++++++ LehrerApp.Desktop/Views/Groups/GroupDetailView.axaml | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/LehrerApp.Desktop/ViewModels/Groups/GroupViewModels.cs b/LehrerApp.Desktop/ViewModels/Groups/GroupViewModels.cs index 37ea713..e9cba7e 100644 --- a/LehrerApp.Desktop/ViewModels/Groups/GroupViewModels.cs +++ b/LehrerApp.Desktop/ViewModels/Groups/GroupViewModels.cs @@ -167,6 +167,13 @@ public partial class GroupDetailViewModel : ObservableObject [ObservableProperty] private StudentSummary? _selectedStudent; [ObservableProperty] private ExamSummary? _selectedExam; + // Eigene Property statt "Group.IsDifferentiated" im Binding-Pfad: die View bindet bereits, + // bevor LoadGroup() läuft (siehe MainWindowViewModel.NavigateToGroupDetail), Group ist dann + // kurzzeitig null — ein verschachtelter Pfad würde dafür jedes Mal einen Binding-Fehler loggen. + public bool IsDifferentiated => Group?.IsDifferentiated ?? false; + + partial void OnGroupChanged(LearningGroup? value) => OnPropertyChanged(nameof(IsDifferentiated)); + public ObservableCollection Students { get; } = []; public ObservableCollection Exams { get; } = []; diff --git a/LehrerApp.Desktop/Views/Groups/GroupDetailView.axaml b/LehrerApp.Desktop/Views/Groups/GroupDetailView.axaml index d052fab..90ff12f 100644 --- a/LehrerApp.Desktop/Views/Groups/GroupDetailView.axaml +++ b/LehrerApp.Desktop/Views/Groups/GroupDetailView.axaml @@ -57,7 +57,7 @@ + IsVisible="{Binding IsDifferentiated}"> + IsVisible="{Binding IsDifferentiated}"/>