Persist selected item display mode changes

This commit is contained in:
Ray Berezowski
2026-06-02 21:52:42 -04:00
parent fb9258d339
commit 84e89ec11c
2 changed files with 23 additions and 1 deletions

View File

@@ -143,7 +143,7 @@
<TextBlock Text="Selected Item Display" Grid.Row="5" VerticalAlignment="Center" Margin="0,0,8,8"/> <TextBlock Text="Selected Item Display" Grid.Row="5" VerticalAlignment="Center" Margin="0,0,8,8"/>
<ComboBox x:Name="ItemDisplayModeBox" Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2" <ComboBox x:Name="ItemDisplayModeBox" Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2"
Margin="0,0,0,8" SelectionChanged="PreviewField_Changed"/> Margin="0,0,0,8" SelectionChanged="ItemDisplayModeBox_SelectionChanged"/>
<TextBlock Text="Preview" Grid.Row="6" VerticalAlignment="Top" Margin="0,4,8,0"/> <TextBlock Text="Preview" Grid.Row="6" VerticalAlignment="Top" Margin="0,4,8,0"/>
<Border Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="2" <Border Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="2"

View File

@@ -114,6 +114,11 @@ public partial class MainWindow : Window
private void ItemsTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e) private void ItemsTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{ {
if (!isLoadingSelection && selectedItem is not null)
{
ApplyCurrentItem();
}
if (e.NewValue is not TreeViewItem treeItem || treeItem.Tag is not LauncherItem item) if (e.NewValue is not TreeViewItem treeItem || treeItem.Tag is not LauncherItem item)
{ {
selectedItem = null; selectedItem = null;
@@ -946,6 +951,23 @@ public partial class MainWindow : Window
} }
} }
private void ItemDisplayModeBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (isLoadingSelection)
{
return;
}
if (selectedItem is not null && ItemDisplayModeBox.SelectedItem is LauncherDisplayMode itemMode)
{
selectedItem.DisplayMode = itemMode;
selectedPath = FindItemPath(selectedItem);
StatusText.Text = "Click Save to keep the selected item display mode.";
}
UpdatePreview();
}
private void EnsureAutomaticIconPath() private void EnsureAutomaticIconPath()
{ {
if (TypeBox.SelectedItem is LauncherItemType.Menu) if (TypeBox.SelectedItem is LauncherItemType.Menu)