Appbar button positioning items automatically UWP
I am working on a UWP app. I am using Appbar buttons to show icon quick buttons for actions. The problem is that the labels are automatically placed horizontally on the icon and some are still placed below the icon. Is there a way that they can be committed? Below is a picture for a clearer understanding of the problem:
But ideally I want them to look below
Is there a way to make sure they (the icons and their corresponding labels) stay vertically aligned. Below is my code:
<AppBarButton Label="Share" Grid.Column="2" HorizontalAlignment="Center">
<AppBarButton.Icon>
<PathIcon HorizontalAlignment="Center" Data="ShareIconPathDataHere"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Label="Add to" Grid.Column="3" HorizontalAlignment="Center">
<AppBarButton.Icon>
<PathIcon HorizontalAlignment="Center" Data="AddToIconPathDataHere"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Label="Report" Grid.Column="4" HorizontalAlignment="Center">
<AppBarButton.Icon>
<PathIcon HorizontalAlignment="Center" Data="ReportIconPathDataHere"/>
</AppBarButton.Icon>
</AppBarButton>
When AppBarButton
used internally CommandBar
, setting the position of the mark is as easy as setting DefaultLabelPosition
from CommandBar
to Bottom
.
Other than that, there are several things you can try.
- Try installing
IsCompact="False"
on eachAppBarButton
. - If 1. doesn't work, open the default style for
AppBarButton
here and removeStoryboard
to visual stateLabelOnRight
. This way, even when the control asks for a label to align to the right, there is no state to set it, so nothing will visually change.
Hope it helps.