Monday, August 10, 2015

Mulitline Xaml button in Windows Phone

Problem:
I was trying to get a button to include multiple lines.  I tried using the declarative syntax in the button

<Button
Content="My Main Title \n Subtitle"/>

This did not work since this is going to render without the formatting implied inline.

Solution:
Really straight forward just add the textbox control into the button control and move on.

<Button
 Command="{Binding MVVMControl}"
 Name="MyFabulousButton">

<TextBlock
TextAlignment="Center"
TextWrapping="Wrap">
First Line
<Linebreak/>
Second Line
</TextBlock>
</Button>






Source
http://stackoverflow.com/questions/1449276/multline-text-in-a-wpf-button

No comments:

Post a Comment