Stundenplan: Popup-Menü im Wochenraster statt Dropdown in der Tagesliste

Nutzer-Feedback: die Tagesliste-Buttons waren schon in Ordnung, das Problem
lag im Wochenraster darüber — ein Klick auf eine Stunden-Kachel führt dort
entweder in den Planungsviewer oder zur Einheitenplanung, ohne dass von
außen erkennbar wäre welches Ziel man bekommt. Tagesliste auf den
ursprünglichen Stand zurückgesetzt.

Neu: ein kleiner "⋮"-Button pro Kachel öffnet ein Popup-Menü mit vier
ausdrücklich benannten Zielen (Unterrichtsansicht/Planungsviewer/Sitzplan/
Planung). MenuFlyout statt ComboBox — dabei verstanden, dass ein
$parent[ItemsControl]-Vorfahrenpfad im Flyout nicht funktioniert, eine
normale {Binding} über die DataContext-Vererbung aber sehr wohl. Der
Direktklick springt jetzt außerdem "einheitlicher": bei einer Lesson
während der eigentlichen Unterrichtszeit direkt in den Unterrichtsmodus
statt in den Viewer.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-27 23:21:49 +02:00
co-authored by Claude Sonnet 5
parent cd08bbbbc4
commit 229ef79e75
5 changed files with 275 additions and 135 deletions
@@ -21,6 +21,21 @@
<Style Selector="Border.supervisioncell.substitution">
<Setter Property="Background" Value="#8E24AA"/>
</Style>
<Style Selector="Button.weekCellMenuTrigger">
<Setter Property="Width" Value="18"/>
<Setter Property="Height" Value="16"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="2"/>
<Setter Property="Background" Value="#33000000"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="CornerRadius" Value="4"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
<Style Selector="Button.weekCellMenuTrigger:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="#55000000"/>
</Style>
</UserControl.Styles>
<Grid RowDefinitions="Auto,Auto,*">
@@ -111,24 +126,17 @@
Foreground="#8E6C00" FontWeight="SemiBold"
IsVisible="{Binding HasUnhandledHomework}"/>
</StackPanel>
<!-- Nutzer-Feedback: unklar, wie man aus der Tagesliste zwischen
Unterrichtsansicht/Sitzplan/Planung/Planungsviewer wechselt — jetzt
ein Dropdown mit ausdrücklich benannten Zielen statt zweier Buttons
mit vom Lesson-Status abhängiger Doppelbedeutung. Wiring/Routing in
TimetableView.axaml.cs (SelectionChanged setzt die Auswahl danach
bewusst zurück auf null — Menü-Charakter, keine dauerhafte
Auswahl). -->
<ComboBox Grid.Column="3" FontSize="11" MinWidth="150" VerticalAlignment="Center"
IsVisible="{Binding HasDestinationOptions}"
PlaceholderText="Öffnen ▾"
ItemsSource="{Binding DestinationOptions}"
SelectionChanged="OnLessonDestinationSelected">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="vm:TimetableDestinationOption">
<TextBlock Text="{Binding Label}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<StackPanel Grid.Column="3" Orientation="Horizontal" Spacing="6" VerticalAlignment="Center">
<Button Content="▶ Unterricht" FontSize="11" Padding="9,4"
IsVisible="{Binding HasLesson}"
ToolTip.Tip="Unterrichtsmodus: Verlaufsplan und Sitzplan mit Schnellbewertung auf einem Bildschirm."
Command="{Binding $parent[ItemsControl].((vm:TimetableViewModel)DataContext).StartTeachingModeCommand}"
CommandParameter="{Binding}"/>
<Button Content="{Binding OpenButtonLabel}" FontSize="11" Padding="9,4"
IsVisible="{Binding HasGroupId}"
Command="{Binding $parent[ItemsControl].((vm:TimetableViewModel)DataContext).OpenTodayLessonCommand}"
CommandParameter="{Binding}"/>
</StackPanel>
</Grid>
</Border>
</DataTemplate>
@@ -233,36 +241,65 @@
</Border>
<Border Classes="timetablecell" Classes.assigned="{Binding IsAssigned}"
CornerRadius="6" IsVisible="{Binding IsSlotCell}">
<Button Background="{Binding ColorHex}" IsVisible="{Binding IsAssigned}"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch" CornerRadius="6" Padding="6"
Command="{Binding $parent[ItemsControl;1].((vm:TimetableViewModel)DataContext).OpenWeekCellCommand}"
CommandParameter="{Binding}">
<StackPanel Spacing="1">
<TextBlock FontSize="11" FontWeight="Bold" Foreground="White" TextWrapping="Wrap">
<Run Text="{Binding SubjectLabel}"/><Run Text=" · "/><Run Text="{Binding GroupName}"/>
</TextBlock>
<TextBlock Text="{Binding Room}" FontSize="10" Foreground="White" Opacity="0.9"
IsVisible="{Binding HasRoom}"/>
<TextBlock Text="{Binding Topic}" FontSize="10" Foreground="White" Opacity="0.8"
TextWrapping="Wrap" IsVisible="{Binding HasTopic}"/>
<TextBlock Text="Ferien" FontSize="10" Foreground="White" FontWeight="SemiBold"
Opacity="0.9" IsVisible="{Binding IsHoliday}" Margin="0,2,0,0"/>
<TextBlock Text="Ausfall" FontSize="10" Foreground="White" FontWeight="SemiBold"
Opacity="0.9" IsVisible="{Binding IsCancelled}" Margin="0,2,0,0"/>
<StackPanel Orientation="Horizontal" Spacing="3" Margin="0,2,0,0"
IsVisible="{Binding !IsHoliday}">
<Border Background="#B71C1C" CornerRadius="7" Padding="4,0" IsVisible="{Binding HasHolidayBadge}">
<TextBlock Text="{Binding HolidayBadge}" FontSize="9" FontWeight="Bold" Foreground="White"/>
</Border>
<TextBlock Text="📝" FontSize="11" IsVisible="{Binding HasExam}" ToolTip.Tip="Klausur"/>
<TextBlock Text="" FontSize="11" IsVisible="{Binding IsLastBeforeExam}" ToolTip.Tip="Letzte Stunde vor der Klausur"/>
<TextBlock Text="🧪" FontSize="11" IsVisible="{Binding HasExperiment}" ToolTip.Tip="Experiment geplant"/>
<TextBlock Text="📓" FontSize="11" IsVisible="{Binding HasUnhandledHomework}"
ToolTip.Tip="Hausaufgabe aus letzter Stunde noch nicht kontrolliert"/>
<Panel IsVisible="{Binding IsAssigned}">
<Button Background="{Binding ColorHex}"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch" CornerRadius="6" Padding="6"
Command="{Binding $parent[ItemsControl;1].((vm:TimetableViewModel)DataContext).OpenWeekCellCommand}"
CommandParameter="{Binding}">
<StackPanel Spacing="1">
<TextBlock FontSize="11" FontWeight="Bold" Foreground="White" TextWrapping="Wrap">
<Run Text="{Binding SubjectLabel}"/><Run Text=" · "/><Run Text="{Binding GroupName}"/>
</TextBlock>
<TextBlock Text="{Binding Room}" FontSize="10" Foreground="White" Opacity="0.9"
IsVisible="{Binding HasRoom}"/>
<TextBlock Text="{Binding Topic}" FontSize="10" Foreground="White" Opacity="0.8"
TextWrapping="Wrap" IsVisible="{Binding HasTopic}"/>
<TextBlock Text="Ferien" FontSize="10" Foreground="White" FontWeight="SemiBold"
Opacity="0.9" IsVisible="{Binding IsHoliday}" Margin="0,2,0,0"/>
<TextBlock Text="Ausfall" FontSize="10" Foreground="White" FontWeight="SemiBold"
Opacity="0.9" IsVisible="{Binding IsCancelled}" Margin="0,2,0,0"/>
<StackPanel Orientation="Horizontal" Spacing="3" Margin="0,2,0,0"
IsVisible="{Binding !IsHoliday}">
<Border Background="#B71C1C" CornerRadius="7" Padding="4,0" IsVisible="{Binding HasHolidayBadge}">
<TextBlock Text="{Binding HolidayBadge}" FontSize="9" FontWeight="Bold" Foreground="White"/>
</Border>
<TextBlock Text="📝" FontSize="11" IsVisible="{Binding HasExam}" ToolTip.Tip="Klausur"/>
<TextBlock Text="" FontSize="11" IsVisible="{Binding IsLastBeforeExam}" ToolTip.Tip="Letzte Stunde vor der Klausur"/>
<TextBlock Text="🧪" FontSize="11" IsVisible="{Binding HasExperiment}" ToolTip.Tip="Experiment geplant"/>
<TextBlock Text="📓" FontSize="11" IsVisible="{Binding HasUnhandledHomework}"
ToolTip.Tip="Hausaufgabe aus letzter Stunde noch nicht kontrolliert"/>
</StackPanel>
</StackPanel>
</StackPanel>
</Button>
</Button>
<!-- Nutzer-Feedback (zweite Runde): Popup-Menü statt Dropdown, hier
im Wochenraster statt in der Tagesliste (dort waren die
bisherigen zwei Buttons schon in Ordnung). Sibling-Button statt
verschachteltem Button/ContextMenu — Routing über
MenuItem.Click in TimetableView.axaml.cs, siehe Kommentar dort
zu DataContext-Vererbung vs. $parent-Vorfahrensuche im Flyout. -->
<Button Classes="weekCellMenuTrigger" Content="⋮"
HorizontalAlignment="Right" VerticalAlignment="Top"
IsVisible="{Binding HasGroupId}"
ToolTip.Tip="Weitere Ziele…">
<Button.Flyout>
<MenuFlyout Placement="BottomEdgeAlignedRight">
<MenuItem Header="▶ Unterrichtsansicht" IsVisible="{Binding HasLesson}"
Tag="{x:Static vm:TimetableLessonDestination.TeachingMode}"
Click="OnWeekCellMenuItemClick"/>
<MenuItem Header="📋 Planungsviewer" IsVisible="{Binding HasLesson}"
Tag="{x:Static vm:TimetableLessonDestination.Viewer}"
Click="OnWeekCellMenuItemClick"/>
<MenuItem Header="🪑 Sitzplan"
Tag="{x:Static vm:TimetableLessonDestination.SeatingPlan}"
Click="OnWeekCellMenuItemClick"/>
<MenuItem Header="✏️ Planung"
Tag="{x:Static vm:TimetableLessonDestination.Planning}"
Click="OnWeekCellMenuItemClick"/>
</MenuFlyout>
</Button.Flyout>
</Button>
</Panel>
</Border>
</Grid>
</DataTemplate>