@@ -15,7 +15,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
15
15
public partial class ExplorerSettings
16
16
{
17
17
private readonly SettingsViewModel _viewModel ;
18
- private readonly List < Expander > _expanders ;
18
+ private readonly List < Expander > _expanders = new ( ) ;
19
19
20
20
public ExplorerSettings ( SettingsViewModel viewModel )
21
21
{
@@ -27,26 +27,6 @@ public ExplorerSettings(SettingsViewModel viewModel)
27
27
DataContext = viewModel ;
28
28
29
29
ActionKeywordModel . Init ( viewModel . Settings ) ;
30
-
31
- // Ensure lbxAccessLinks and lbxExcludedPaths are initialized before accessing Items
32
- // This might require Loaded event if they are not immediately available
33
- // For now, assuming they are available after InitializeComponent()
34
- if ( lbxAccessLinks != null )
35
- lbxAccessLinks . Items . SortDescriptions . Add ( new SortDescription ( "Path" , ListSortDirection . Ascending ) ) ;
36
-
37
- if ( lbxExcludedPaths != null )
38
- lbxExcludedPaths . Items . SortDescriptions . Add ( new SortDescription ( "Path" , ListSortDirection . Ascending ) ) ;
39
-
40
- _expanders = new List < Expander >
41
- {
42
- GeneralSettingsExpander ,
43
- ContextMenuExpander ,
44
- PreviewPanelExpander ,
45
- EverythingExpander ,
46
- ActionKeywordsExpander ,
47
- QuickAccessExpander ,
48
- ExcludedPathsExpander
49
- } ;
50
30
}
51
31
52
32
private void AccessLinkDragDrop ( string containerName , DragEventArgs e )
@@ -124,5 +104,30 @@ private void Expander_Expanded(object sender, RoutedEventArgs e)
124
104
}
125
105
}
126
106
}
107
+
108
+ private void lbxAccessLinks_Loaded ( object sender , RoutedEventArgs e )
109
+ {
110
+ lbxAccessLinks . Items . SortDescriptions . Add ( new SortDescription ( "Path" , ListSortDirection . Ascending ) ) ;
111
+ }
112
+
113
+ private void lbxExcludedPaths_Loaded ( object sender , RoutedEventArgs e )
114
+ {
115
+ lbxExcludedPaths . Items . SortDescriptions . Add ( new SortDescription ( "Path" , ListSortDirection . Ascending ) ) ;
116
+ }
117
+
118
+ private void GeneralSettingsExpander_Loaded ( object sender , RoutedEventArgs e )
119
+ {
120
+ var expanders = new List < Expander >
121
+ {
122
+ GeneralSettingsExpander ,
123
+ ContextMenuExpander ,
124
+ PreviewPanelExpander ,
125
+ EverythingExpander ,
126
+ ActionKeywordsExpander ,
127
+ QuickAccessExpander ,
128
+ ExcludedPathsExpander
129
+ } ;
130
+ _expanders . AddRange ( expanders ) ;
131
+ }
127
132
}
128
133
}
0 commit comments