From 7687bc7beae2474b1035896000291b35856886b9 Mon Sep 17 00:00:00 2001 From: Andrew KeepCoding Date: Mon, 23 Jun 2025 14:23:51 +0900 Subject: [PATCH] Fix workaround in Segmented control by resetting SelectedIndex during template application This commit modifies the `OnApplyTemplate` method in the `Segmented` class to set `SelectedIndex` to `-1` and then assign `_internalSelectedIndex` if `_hasLoaded` is false. This ensures the selected index is reset before applying the internal selection and marks the template as loaded. --- components/Segmented/src/Segmented/Segmented.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/components/Segmented/src/Segmented/Segmented.cs b/components/Segmented/src/Segmented/Segmented.cs index 8441866a..d649ce46 100644 --- a/components/Segmented/src/Segmented/Segmented.cs +++ b/components/Segmented/src/Segmented/Segmented.cs @@ -39,6 +39,7 @@ protected override void OnApplyTemplate() base.OnApplyTemplate(); if (!_hasLoaded) { + SelectedIndex = -1; SelectedIndex = _internalSelectedIndex; _hasLoaded = true; }