How to prevent AppBarButton.Label from wrapping?

Hong 1,046 Reputation points
2019-12-18T01:23:46.413+00:00

Is there a way to prevent AppBarButton.Label from wrapping?

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

Accepted answer
  1. Richard Zhang-MSFT 6,936 Reputation points
    2019-12-18T03:08:29.15+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    Did you mean that the label no longer wraps automatically when the Label is at the bottom of the AppBarButton?

    This is the default behavior of AppBarButton and does not provide an external API to change this behavior. If you want to implement this requirement, you need to modify the style of AppBarButton

    Try this code:

    Due to forum reasons, XAML code cannot be posted for the time being, we are actively addressing this issue

    Xaml Code

    Imgur

    The key modification is this TextBlock. In the default style, its TextWrapping property is Wrap. Here we can modify it.

    At the same time, in order to remind the user that the Label is not displayed completely, we can set TextTrimming = "CharacterEllipsis" so that an ellipsis will be displayed when the text overflows.

    Usage

    <AppBarButton Label="Test Button" Style="{StaticResource AppBarButtonNoWrapStyle}"/>

    Thanks

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful