AppBarSeparator not aligned with AppBarButtons in CommandBar
See original GitHub issueDescribe the bug By default, the AppBarSeparator is not located in the vertical center of the CommandBar, causing it to not align with the center of AppBarButtons.
Sample code:
<CommandBar> <AppBarButton Icon="ClearSelection" /> <AppBarButton Icon="SelectAll" /> <AppBarSeparator /> <AppBarButton Icon="Clear" /> </CommandBar>
As you can see in screenshots, the separator is clearly off center.
Steps to reproduce the bug
- Use the code provided above and observe.
- Change the CommandBar VerticalAlignment to Center, and we’ll have the same results.
Expected behavior AppBarSeparator should align well with other elements in the CommandBar. Or at least, when VerticalAlignment is set to center, it should be vertically centered.
We have used the following style to resolve the issue, but this only works when the label position is set to right or none.
<Style TargetType="AppBarSeparator"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="AppBarSeparator"> <Rectangle x:Name="SeparatorRectangle" Width="1" Height="20" Fill="{TemplateBinding Foreground}" Margin="16,0" VerticalAlignment="Center"> </Rectangle> </ControlTemplate> </Setter.Value> </Setter> </Style>
Screenshots
Version Info
NuGet package version: 2.4.3
Windows 10 version | Saw the problem? |
---|---|
Insider Build (21264) | Yes |
May 2020 Update (19041) | |
November 2019 Update (18363) | |
May 2019 Update (18362) | |
October 2018 Update (17763) | |
April 2018 Update (17134) | |
Fall Creators Update (16299) | |
Creators Update (15063) |
Device form factor | Saw the problem? |
---|---|
Desktop | Yes |
Xbox | |
Surface Hub | |
IoT |
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:13 (11 by maintainers)
Top GitHub Comments
If the separator won’t resize to be centred into the bar when it resizes to show the labels, it should at the very least remain in line with the icons.
But I think being centred in the bar, and resizing, would make the most sense.
Oh misunderstood you there, sorry. I agree that other controls could get updated/edited animation wise given that CommandBarFlyout has very good animations.