Reputation: 1090
I have an app with some button which contains different text, of different length. When the text is longer than the width of the button, only the first part of the text is displayed. Is there a way to dynamically split the text in 2 lines or more? Thanks
Upvotes: 0
Views: 419
Reputation: 151
For specific breaks in your text I like to use Runs and LineBreaks
<Button>
<TextBlock TextWrapping="Wrap" FontSize="9">
<Run Text="Bind some text here" />
<LineBreak/>
<Run Text="Add some more text" />
</TextBlock>
</Button>
Upvotes: 1
Reputation: 16956
Use TextBlock
to define button content and set TextWrapping
property.
<Button>
<TextBlock TextWrapping="Wrap">your text</TextBlock>
</Button>
Upvotes: 3