Multline Text in a WPF Button

Posted by Paul on Stack Overflow See other posts from Stack Overflow or by Paul
Published on 2009-09-19T19:17:22Z Indexed on 2010/04/09 1:23 UTC
Read the original article Hit count: 323

Filed under:
|
|

How do I get multi-line text on a WPF Button using only C#? I have seen examples of using <LineBreak/> in XAML, but my buttons are created completely programmatically in C#. The number and labels on the buttons correspond to values in the domain model, so I don't think I can use XAML to specify this.

I have tried the naive approach below, but it does not work.

Button b = new Button();
b.Content = "Two\nLines";

or

b.Content = "Two\r\nLines";

In either case, all i see is the first line ("Two") of the text.

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf