Skip to content

Commit 4218b63

Browse files
committed
Add size changed event
1 parent 29b7462 commit 4218b63

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,8 @@
746746
Drop="LbxAccessLinks_OnDrop"
747747
ItemsSource="{Binding Settings.QuickAccessLinks}"
748748
Loaded="lbxAccessLinks_Loaded"
749-
SelectedItem="{Binding SelectedQuickAccessLink}">
749+
SelectedItem="{Binding SelectedQuickAccessLink}"
750+
SizeChanged="lbxAccessLinks_SizeChanged">
750751
<ListView.View>
751752
<GridView>
752753
<GridViewColumn Width="600" Header="{DynamicResource plugin_explorer_name}">

Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,5 +125,22 @@ private void lbxExcludedPaths_Loaded(object sender, RoutedEventArgs e)
125125
{
126126
lbxExcludedPaths.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
127127
}
128+
129+
private void lbxAccessLinks_SizeChanged(object sender, SizeChangedEventArgs e)
130+
{
131+
if (sender is not ListView listView) return;
132+
if (listView.View is not GridView gView) return;
133+
134+
var workingWidth =
135+
listView.ActualWidth - SystemParameters.VerticalScrollBarWidth; // take into account vertical scrollbar
136+
137+
if (workingWidth <= 0) return;
138+
139+
var col1 = 0.6;
140+
var col2 = 0.4;
141+
142+
gView.Columns[0].Width = workingWidth * col1;
143+
gView.Columns[1].Width = workingWidth * col2;
144+
}
128145
}
129146
}

0 commit comments

Comments
 (0)