File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
components/SegmentedControl/src/Segmented Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ namespace CommunityToolkit.Labs.WinUI;
99public partial class Segmented : ListViewBase
1010{
1111 private int _internalSelectedIndex = - 1 ;
12+ private bool _hasLoaded = false ;
13+
1214 public Segmented ( )
1315 {
1416 this . DefaultStyleKey = typeof ( Segmented ) ;
@@ -26,7 +28,11 @@ protected override bool IsItemItsOwnContainerOverride(object item)
2628 protected override void OnApplyTemplate ( )
2729 {
2830 base . OnApplyTemplate ( ) ;
29- SelectedIndex = _internalSelectedIndex ;
31+ if ( ! _hasLoaded )
32+ {
33+ SelectedIndex = _internalSelectedIndex ;
34+ _hasLoaded = true ;
35+ }
3036 PreviewKeyDown -= Segmented_PreviewKeyDown ;
3137 PreviewKeyDown += Segmented_PreviewKeyDown ;
3238 }
You can’t perform that action at this time.
0 commit comments