Wordwrap in Ribbon Button

Ribbon for WPF Forum

Posted 6 years ago by Stefan Link
Version: 17.2.0665

Is it possible to get a word wrap for special characters like '-' within a ribbon button (like i can get within a TextBlock)?


public class MainViewModel
    public string ShortLabel => "T-S";
    public string ShortLabelWithSpace => "T- S";
    public string ShortLabelWithNonVisibleSpace => "T-\u200BS";
    public string LongLabel => "Test-String";
    public string LongLabelWithSpace => "Test- String";
    public string LongLabelWithNonVisibleSpace => "Test-\u200BString";
    <viewModel:MainViewModel />


    <ribbon:Ribbon DockPanel.Dock="Top">
        <ribbon:Tab Label="TEST">
            <ribbon:Group Label="Test Group">
                <ribbon:Button Label="{Binding ShortLabel}" />
                <ribbon:Button Label="{Binding ShortLabelWithSpace}" />
                <ribbon:Button Label="{Binding ShortLabelWithNonVisibleSpace}" />
                <ribbon:Button Label="{Binding LongLabel}" />
                <ribbon:Button Label="{Binding LongLabelWithSpace}" />
                <ribbon:Button Label="{Binding LongLabelWithNonVisibleSpace}" />


    <StackPanel Orientation="Horizontal">
        <TextBlock Text="{Binding ShortLabel}" Width="50" TextWrapping="Wrap" />
        <TextBlock Text="{Binding ShortLabelWithSpace}" Width="50" TextWrapping="Wrap" />
        <TextBlock Text="{Binding ShortLabelWithNonVisibleSpace}" Width="50" TextWrapping="Wrap" />
        <!-- This is the case that's not working -->	  
        <TextBlock Text="{Binding LongLabel}" Width="50" TextWrapping="Wrap" />
	<!-- Ugly if the text is too short and no line break occurs (see short label example) -->  
        <TextBlock Text="{Binding LongLabelWithSpace}" Width="50" TextWrapping="Wrap" /> 

	<!-- Special space character also doesn't work -->  
        <TextBlock Text="{Binding LongLabelWithNonVisibleSpace}" Width="50" TextWrapping="Wrap" />

Comments (2)

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Stefan,

We currently support wrapping via the "WithSpace" examples but not the other two. 

We have made a code update for the next build to allow the "WithNonVisibleSpace" examples as well. 

We can't do the other one (no space) though because the buttons only allow two lines and we need to know where a possible break should occur.  We look for whitespace characters to know where those breaks can be.

Actipro Software Support

Posted 6 years ago by Stefan Link

Thanks, even the small changes help a lot!

The latest build of this product (v24.1.2) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.