Add size changed event

This commit is contained in:
Jack251970 2025-06-07 13:46:57 +08:00
parent 29b74624c7
commit 4218b636fe
2 changed files with 19 additions and 1 deletions

View file

@ -746,7 +746,8 @@
Drop="LbxAccessLinks_OnDrop"
ItemsSource="{Binding Settings.QuickAccessLinks}"
Loaded="lbxAccessLinks_Loaded"
SelectedItem="{Binding SelectedQuickAccessLink}">
SelectedItem="{Binding SelectedQuickAccessLink}"
SizeChanged="lbxAccessLinks_SizeChanged">
<ListView.View>
<GridView>
<GridViewColumn Width="600" Header="{DynamicResource plugin_explorer_name}">

View file

@ -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;
}
}
}