TX Text Control .NET for WPF

Centered 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

Gets or sets a value specifying whether text is centered at the current input position. If text is selected, the property specifies this attribute for the whole selected text.

Syntax

public bool? Centered { get; set; }

Examples

The following XAML example binds the Centered property to a ToggleButton:

<ToggleButton 
    Height="29"
    Name="buttonCentered"
    IsChecked="{Binding ElementName=textControl1, Path=InputFormat.Centered, Mode=TwoWay}">
    Centered</ToggleButton>

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

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

inputFormat.Centered = true;
if (inputFormat.Centered != null)
{
    Console.WriteLine("Input Format: Centered is available.");
}

Remarks

The property returns null when the text selection contains multiple paragraphs with mixed setting.