Multline Text in a WPF Button
- by Paul
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.