TextColor Property
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. Core. SDK TXTextControl.from the private NuGet feed or Text Control Offline PackagesCore. dll
- Also in
TXTextControl.asTextControl. ASP. SDK TXTextControl.dll
Description
Returns or sets the color used to display the text at the current input position. If text is selected, the property specifies the text color of the whole selected text.
Syntax
public Color? TextColor { get; set; }Public Property TextColor As Color?Examples
The following XAML example shows how to bind the TextColor property to the fill color of a rectangle using the WPF.ColorConverter class.
…
xmlns:tx="clr-namespace:TXTextControl.WPF;assembly=TXTextControl.WPF"
…
<Window.Resources>
<tx:ColorConverter x:Key="colorConv" />
</Window.Resources>
…
<Rectangle
Width="20"
Height="20">
<Rectangle.Fill>
<SolidColorBrush
Color="{Binding
ElementName=textControl1,
Path=InputFormat.TextColor,
Converter={StaticResource colorConv}}" />
</Rectangle.Fill>
</Rectangle>The following example changes the formatting applied to text entered at the end of a document by using InputFormat.TextColor.
textControl.Text = "Project summary";
textControl.InputPosition = new InputPosition(textControl.Text.Length);
InputFormat inputFormat = textControl.InputFormat;
inputFormat.TextColor = System.Drawing.Color.LightSteelBlue;
if (inputFormat.TextColor != null)
{
Console.WriteLine("Input Format: Text Color is available.");
}textControl.Text = "Project summary"
textControl.InputPosition = New InputPosition(textControl.Text.Length)
Dim inputFormat As InputFormat = textControl.InputFormat
inputFormat.TextColor = System.Drawing.Color.LightSteelBlue
If inputFormat.TextColor IsNot Nothing Then
Console.WriteLine("Input Format: Text Color is available.")
End IfRemarks
The property returns null when the text selection contains multiple characters with mixed colors.