Search code examples
c#buttontextwindows-phonemultiline

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


Solution

  • Use TextBlock to define button content and set TextWrapping property.

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