microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

Wrong layout for small AppBarButtons in TextCommandBarFlyout

Open tipa opened this issue 7 months ago • 4 comments

Describe the bug

The icons for the primary commands in a TextCommandBarFlyout aren't centered

Image

Steps to reproduce the bug

<RichEditBox x:Name="textBox"/>

textBox.SelectionFlyout.Opening += Menu_Opening;
textBox.ContextFlyout.Opening += Menu_Opening;
void Menu_Opening(object sender, object e)
{
    var myFlyout = sender as TextCommandBarFlyout;
    foreach (var item in myFlyout.PrimaryCommands.OfType<AppBarToggleButton>()) { item.Label = null; }
}

Right-click test area

Expected behavior

Icon's are correctly aligned/centered

NuGet package version

WinUI 3 - Windows App SDK 1.8 Experimental 1: 1.8.250515001-experimental2

Windows version

Windows 11 (24H2): Build 26100

tipa avatar May 26 '25 08:05 tipa

From what I can tell it's because VerticalAlignment of the IconAndLabelPanel Grid was changed to Center for AppBarButton, but not for AppBarToggleButton:

https://github.com/microsoft/microsoft-ui-xaml/commit/67aeb8f236eb85d2c541d5fc07e3df73aeb9b4d1#diff-3c0c71d84b9ce65cd15e61c585b987f27e66b03f5d7fd5a36279ba759ea313caL293

https://github.com/microsoft/microsoft-ui-xaml/commit/67aeb8f236eb85d2c541d5fc07e3df73aeb9b4d1#diff-3c0c71d84b9ce65cd15e61c585b987f27e66b03f5d7fd5a36279ba759ea313caL507

tipa avatar May 26 '25 09:05 tipa

@tipa could you please provide a minimal repro for this. From the code you provided I couldn't repro it.

hiteshkrmsft avatar Jun 04 '25 08:06 hiteshkrmsft

I believe you mean formatting command are vertically not aligned-

Image

hiteshkrmsft avatar Jun 04 '25 09:06 hiteshkrmsft

@hiteshkrmsft correct - the icons should be aligned vertically. You can see from my linked commits in my comment above that in the AppBarToggleButton style the IconAndLabelPanel is not aligned vertically: https://github.com/microsoft/microsoft-ui-xaml/blob/67aeb8f236eb85d2c541d5fc07e3df73aeb9b4d1/src/controls/dev/CommandBarFlyout/CommandBarFlyout_themeresources.xaml#L507

tipa avatar Jun 04 '25 09:06 tipa

Additionally, the EllipsisButton now looks different (higher) compared to before in UWP. Note the top/padding margin/padding:

UWP:

Image

WinUI3: Image

I believe this can be resolved by setting this VerticalAlignment to Center: https://github.com/microsoft/microsoft-ui-xaml/blob/67aeb8f236eb85d2c541d5fc07e3df73aeb9b4d1/src/controls/dev/CommandBarFlyout/CommandBarFlyout_themeresources.xaml#L574

tipa avatar Aug 13 '25 10:08 tipa