From 4218b636fe93f94c2a40096bcac5cb6f3afd1ccd Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 7 Jun 2025 13:46:57 +0800 Subject: [PATCH] Add size changed event --- .../Views/ExplorerSettings.xaml | 3 ++- .../Views/ExplorerSettings.xaml.cs | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index 2d1e5bd8a..547674dc0 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -746,7 +746,8 @@ Drop="LbxAccessLinks_OnDrop" ItemsSource="{Binding Settings.QuickAccessLinks}" Loaded="lbxAccessLinks_Loaded" - SelectedItem="{Binding SelectedQuickAccessLink}"> + SelectedItem="{Binding SelectedQuickAccessLink}" + SizeChanged="lbxAccessLinks_SizeChanged"> diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs index 2c50f1c6f..415d3f8ff 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs @@ -125,5 +125,22 @@ namespace Flow.Launcher.Plugin.Explorer.Views { lbxExcludedPaths.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending)); } + + private void lbxAccessLinks_SizeChanged(object sender, SizeChangedEventArgs e) + { + if (sender is not ListView listView) return; + if (listView.View is not GridView gView) return; + + var workingWidth = + listView.ActualWidth - SystemParameters.VerticalScrollBarWidth; // take into account vertical scrollbar + + if (workingWidth <= 0) return; + + var col1 = 0.6; + var col2 = 0.4; + + gView.Columns[0].Width = workingWidth * col1; + gView.Columns[1].Width = workingWidth * col2; + } } }