Re-attach toggle button click handler after navigation#1445
Merged
pomianowski merged 1 commit intolepoco:mainfrom Jun 10, 2025
jbryknar:main
Merged
Re-attach toggle button click handler after navigation#1445pomianowski merged 1 commit intolepoco:mainfrom jbryknar:main
pomianowski merged 1 commit intolepoco:mainfrom
jbryknar:main
Conversation
pomianowski
approved these changes
Jun 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
The toggle button part of the SplitButton stops working if you navigate away from a page and then come back to it using the PageService navigation and the page is registered using AddSingleton.
The problem appears to be how the toggle button Click event is registered and unregistered. The toggle button Click event is registered in the OnApplyTemplate routine which is only executed the first time the page is displayed. It's unregistered in an Unloaded event which executes every time you navigate away from the page, so the second and subsequent times you navigate to the page, the Click event is no longer registered and that part of the SplitButton stops working.
This problem has been referenced here, but I don't see a committed functional solution anywhere: #1179
What is the new behavior?
The SplitButton now correctly reattaches the ToggleButton click event handler after navigating away from and back to the page. This ensures the toggle portion of the button remains functional even when the page is registered as a singleton and reused via the PageService.