mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Change Tabcontrol to Expander
This commit is contained in:
parent
9d3888f71d
commit
8c5e0c948f
2 changed files with 698 additions and 721 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue