TX Text Control .NET for WPF

StyleNames Property

Property|Introduced in 16.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WPF.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

Returns an array of the names of all formatting styles, the document contains. This property can be used to fill a combo box or a menu.

Syntax

public string[] StyleNames { get; }

Examples

The following XAML example shows how to bind the StyleName property to a combo box which contains all style names returned by the StyleNames property.

<ComboBox
    Width="200"
    IsEditable="True"
    IsReadOnly="True"
    Text="{Binding ElementName=textControl1, Path=InputFormat.StyleName}"
    ItemsSource="{Binding ElementName=textControl1, Path=InputFormat.StyleNames}" />

The following example changes the formatting applied to text entered at the end of a document by using InputFormat.StyleNames.

textControl.Text = "Project summary";
textControl.InputPosition = new InputPosition(textControl.Text.Length);
InputFormat inputFormat = textControl.InputFormat;

foreach (string text in inputFormat.StyleNames)
{
    Console.WriteLine(text.Length);
}

Limitations

Read only.