StyleNames Property
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WinForms. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
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; }Public ReadOnly Property StyleNames As String()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);
}textControl.Text = "Project summary"
textControl.InputPosition = New InputPosition(textControl.Text.Length)
Dim inputFormat As InputFormat = textControl.InputFormat
For Each text As String In inputFormat.StyleNames
Console.WriteLine(text.Length)
NextLimitations
Read only.