question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AppBarSeparator not aligned with AppBarButtons in CommandBar

See original GitHub issue

Describe 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

  1. Use the code provided above and observe.
  2. 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 image image

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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:13 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
mdtaukcommented, Dec 23, 2020

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.

image

1reaction
chingucodingcommented, Dec 23, 2020

Oh misunderstood you there, sorry. I agree that other controls could get updated/edited animation wise given that CommandBarFlyout has very good animations.

Read more comments on GitHub >

github_iconTop Results From Across the Web

UWP CommandBar has gap at the bottom
CommandBar doesn't have a bottom vertical alignment, and its height is lower than the height of its container so it is expected to...
Read more >
Command bar - Windows apps
Learn how to use command bar controls to give users easy access to your app's most common commands and tasks.
Read more >
AppBarSeparator Class (Windows.UI.Xaml.Controls)
Represents a line that separates items in an AppBar or CommandBar. ... Non-WinUI styles: When you use the built-in styles, the default style,...
Read more >
CommandBar
AppBarToggleButton and AppBarSeparator are not supported. Refer to the AppBarButton section for details. SecondaryCommands. Gets the collection of secondary ...
Read more >
Aligning UWP CommandBar content after Anniversary Update
Let's demonstrate the issue with a simple example. <CommandBar HorizontalContentAlignment="Center"> <AppBarButton Icon="Accept" /> <CommandBar.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found