File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,23 +114,18 @@ public HistoriesCommitList()
114114 VerticalScrollBarVisibility = ScrollBarVisibility . Auto ;
115115 }
116116
117+ protected override void OnLoaded ( RoutedEventArgs e )
118+ {
119+ base . OnLoaded ( e ) ;
120+ ApplySelection ( ) ;
121+ }
122+
117123 protected override void OnPropertyChanged ( AvaloniaPropertyChangedEventArgs change )
118124 {
119125 base . OnPropertyChanged ( change ) ;
120126
121127 if ( change . Property == SelectedCommitsProperty && IsLoaded && ! _ignoreSelectionChanged )
122- {
123- _ignoreSelectionChanged = true ;
124-
125- SelectedItems . Clear ( ) ;
126- if ( SelectedCommits is { Count : > 0 } )
127- {
128- foreach ( var c in SelectedCommits )
129- SelectedItems . Add ( c ) ;
130- }
131-
132- _ignoreSelectionChanged = false ;
133- }
128+ ApplySelection ( ) ;
134129 }
135130
136131 protected override void OnSelectionChanged ( SelectionChangedEventArgs e )
@@ -180,6 +175,20 @@ protected override void OnSelectionChanged(SelectionChangedEventArgs e)
180175 }
181176 }
182177
178+ private void ApplySelection ( )
179+ {
180+ _ignoreSelectionChanged = true ;
181+
182+ SelectedItems . Clear ( ) ;
183+ if ( SelectedCommits is { Count : > 0 } )
184+ {
185+ foreach ( var c in SelectedCommits )
186+ SelectedItems . Add ( c ) ;
187+ }
188+
189+ _ignoreSelectionChanged = false ;
190+ }
191+
183192 private bool _ignoreSelectionChanged = false ;
184193 }
185194
You can’t perform that action at this time.
0 commit comments