fix(controls): Fix SplitButton various issues#1498
Merged
pomianowski merged 10 commits intolepoco:mainfrom Nov 7, 2025
Merged
Conversation
Nuklon
commented
Jul 29, 2025
| <ControlTemplate TargetType="{x:Type controls:SplitButton}"> | ||
| <Border | ||
| x:Name="ContentBorder" | ||
| Grid.Row="0" |
Collaborator
Author
There was a problem hiding this comment.
This isn't needed, there's no Grid, so I removed it as well.
Nuklon
commented
Jul 29, 2025
| Grid.Column="1" | ||
| VerticalAlignment="Center" | ||
| Content="{TemplateBinding Content}" | ||
| ContentTemplate="{TemplateBinding ContentTemplate}" |
Collaborator
Author
There was a problem hiding this comment.
I also added this so ContentTemplate can be used.
Nuklon
commented
Jul 29, 2025
| <ControlTemplate TargetType="{x:Type ToggleButton}"> | ||
| <Border | ||
| x:Name="ContentBorder" | ||
| Margin="0,-1,-1,-1" |
Collaborator
Author
There was a problem hiding this comment.
This caused the toggle button to be off-center, there's no need for this, so just remove it.
Nuklon
commented
Jul 29, 2025
| Foreground="{TemplateBinding Foreground}" | ||
| IsChecked="{TemplateBinding IsDropDownOpen}" | ||
| Style="{StaticResource DefaultSplitButtonToggleButtonStyle}"> | ||
| Style="{DynamicResource DefaultSplitButtonToggleButtonStyle}"> |
Collaborator
Author
There was a problem hiding this comment.
So we can override the style of the toggle button without having to redeclare the entire template.
Update SplitButton.xaml
Nuklon
commented
Jul 29, 2025
| { | ||
| if (SplitButtonToggleButton != null) | ||
| { | ||
| SplitButtonToggleButton.Click -= OnSplitButtonToggleButtonOnClick; |
Collaborator
Author
There was a problem hiding this comment.
This had to be changed to PreviewMouseLeftButtonUp for two reasons.
- If the Click event is used, there's hardly any visible Pressed state as it instantly presses.
- The SplitButton's context menu would immediately open on mouse down, this isn't the same in WinUI, where a mouse up is required.
Nuklon
commented
Jul 29, 2025
| }; | ||
| } | ||
|
|
||
| protected virtual void AttachTemplateResources() |
Collaborator
Author
There was a problem hiding this comment.
This is unused, so remove.
7 tasks
pomianowski
approved these changes
Nov 7, 2025
SplitButton various issues
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?
Currently, a SplitButton has a mouseover/pressed color for the entire element. This isn't what WinUI does, it only changes this for the part hovered over (i.e., content and the toggle button).
New:


(only toggle has mouseover brush).
(only content has mouseover brush).
Old:

(entire button has mouseover brush).