Unbreaking things that were broken

This commit is contained in:
Niels Laute
2026-02-02 21:17:05 +01:00
parent 7159b8c17b
commit cc87469ada
2 changed files with 25 additions and 56 deletions

View File

@@ -28,34 +28,33 @@
<StackPanel Orientation="Vertical" Spacing="4" />
</ItemsPanelTemplate>
<DataTemplate x:Key="DeskbandTemplate" x:DataType="dockVm:DockItemViewModel">
<local:DockItemControl
Title="{x:Bind Title, Mode=OneWay}"
RightTapped="BandItem_RightTapped"
Subtitle="{x:Bind Subtitle, Mode=OneWay}"
Tapped="BandItem_Tapped"
ToolTip="{x:Bind Tooltip, Mode=OneWay}">
<local:DockItemControl.Icon>
<cpcontrols:IconBox
x:Name="IconBorder"
Width="16"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
SourceKey="{x:Bind Icon, Mode=OneWay}"
SourceRequested="{x:Bind help:IconCacheProvider.SourceRequested}" />
</local:DockItemControl.Icon>
</local:DockItemControl>
</DataTemplate>
<DataTemplate x:Key="DockBandTemplate" x:DataType="dockVm:DockBandViewModel">
<ItemsRepeater
ItemTemplate="{StaticResource DeskbandTemplate}"
ItemsSource="{x:Bind Items, Mode=OneWay}"
Layout="{StaticResource ItemsOrientationLayout}">
<ItemsRepeater ItemsSource="{x:Bind Items, Mode=OneWay}" Layout="{StaticResource ItemsOrientationLayout}">
<ItemsRepeater.Transitions>
<TransitionCollection />
</ItemsRepeater.Transitions>
<ItemsRepeater.ItemTemplate>
<DataTemplate x:DataType="dockVm:DockItemViewModel">
<local:DockItemControl
Title="{x:Bind Title, Mode=OneWay}"
RightTapped="BandItem_RightTapped"
Subtitle="{x:Bind Subtitle, Mode=OneWay}"
Tag="{x:Bind}"
Tapped="BandItem_Tapped"
ToolTip="{x:Bind Tooltip, Mode=OneWay}">
<local:DockItemControl.Icon>
<cpcontrols:IconBox
x:Name="IconBorder"
Width="16"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
SourceKey="{x:Bind Icon, Mode=OneWay}"
SourceRequested="{x:Bind help:IconCacheProvider.SourceRequested}" />
</local:DockItemControl.Icon>
</local:DockItemControl>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</DataTemplate>

View File

@@ -189,13 +189,13 @@ public sealed partial class DockControl : UserControl, IRecipient<CloseContextMe
private void BandItem_RightTapped(object sender, Microsoft.UI.Xaml.Input.RightTappedRoutedEventArgs e)
{
if (sender is DockItemControl dockItem && dockItem.DataContext is DockItemViewModel item)
if (sender is DockItemControl dockItem && dockItem.DataContext is DockBandViewModel band && dockItem.Tag is DockItemViewModel item)
{
// In edit mode, show the edit mode context menu (show/hide labels)
if (IsEditMode)
{
// Find the parent DockBandViewModel for this item
_editModeContextBand = FindParentBand(item);
_editModeContextBand = band;
if (_editModeContextBand != null)
{
// Update toggle menu item checked state based on current settings
@@ -231,36 +231,6 @@ public sealed partial class DockControl : UserControl, IRecipient<CloseContextMe
}
}
private DockBandViewModel? FindParentBand(DockItemViewModel item)
{
// Search all bands to find which one contains this item
foreach (var band in ViewModel.StartItems)
{
if (band.Items.Contains(item))
{
return band;
}
}
foreach (var band in ViewModel.CenterItems)
{
if (band.Items.Contains(item))
{
return band;
}
}
foreach (var band in ViewModel.EndItems)
{
if (band.Items.Contains(item))
{
return band;
}
}
return null;
}
private void ShowTitlesMenuItem_Click(object sender, RoutedEventArgs e)
{
if (_editModeContextBand != null)