Sven Borden
Sven Borden

Reputation: 1090

Add multiline content to button in c# windows phone 8.1

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

Answers (2)

Lexi Mize
Lexi Mize

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

Hari Prasad
Hari Prasad

Reputation: 16956

Use TextBlock to define button content and set TextWrapping property.

<Button>
  <TextBlock TextWrapping="Wrap">your text</TextBlock>
</Button>

Upvotes: 3

Related Questions