Reputation: 31887
How can I set the TextFormattingMode
property programmatically to the MainWindow class?
<Window x:Class="EditorExample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525"
TextOptions.TextFormattingMode="Display">
</Window>
Upvotes: 1
Views: 438
Reputation: 33381
I assume that you want to set from ManiWindow
class. TextOptions.TextFormattingMode
is an attached property.
this.SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Display);
Upvotes: 5
Reputation: 5366
You add the property using the below code.
TextOptions.SetTextFormattingMode(this, TextFormattingMode.Display);
Upvotes: 2