Change Tabcontrol to Expander

This commit is contained in:
DB P 2025-06-06 17:05:12 +09:00
parent 9d3888f71d
commit 8c5e0c948f
2 changed files with 698 additions and 721 deletions

View file

@ -1,4 +1,5 @@
using System.ComponentModel;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Windows;
@ -11,28 +12,39 @@ using DragEventArgs = System.Windows.DragEventArgs;
namespace Flow.Launcher.Plugin.Explorer.Views
{
/// <summary>
/// Interaction logic for ExplorerSettings.xaml
/// </summary>
public partial class ExplorerSettings
{
private readonly SettingsViewModel viewModel;
private List<Expander> _expanders;
public ExplorerSettings(SettingsViewModel viewModel)
{
DataContext = viewModel;
InitializeComponent();
this.viewModel = viewModel;
DataContext = viewModel;
// DataContext = viewModel; // Removed duplicate
ActionKeywordModel.Init(viewModel.Settings);
lbxAccessLinks.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
// Ensure lbxAccessLinks and lbxExcludedPaths are initialized before accessing Items
// This might require Loaded event if they are not immediately available
// For now, assuming they are available after InitializeComponent()
if (lbxAccessLinks != null)
lbxAccessLinks.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
if (lbxExcludedPaths != null)
lbxExcludedPaths.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
lbxExcludedPaths.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
_expanders = new List<Expander>
{
GeneralSettingsExpander,
ContextMenuExpander,
PreviewPanelExpander,
EverythingExpander,
ActionKeywordsExpander,
QuickAccessExpander,
ExcludedPathsExpander
};
}
private void AccessLinkDragDrop(string containerName, DragEventArgs e)
@ -93,5 +105,22 @@ namespace Flow.Launcher.Plugin.Explorer.Views
{
e.Handled = e.Text.ToCharArray().Any(c => !char.IsDigit(c));
}
private void Expander_Expanded(object sender, RoutedEventArgs e)
{
if (sender is Expander expandedExpander)
{
// Ensure _expanders is not null and contains items
if (_expanders == null || !_expanders.Any()) return;
foreach (var expander in _expanders)
{
if (expander != null && expander != expandedExpander && expander.IsExpanded)
{
expander.IsExpanded = false;
}
}
}
}
}
}