TX Text Control Blog

Using the IsCommonValueSelected property

Blogged by Björn Meyer on February 10, 2006 and tagged with samples, .net.

One of the least commonly used properties of the Selection class is IsCommonValueSelected. I have recently assisted several customers with this property and thus would like to take this opportunity to explain its exact functionality.

This property informs on whether a certain attribute has the same value as the value of the complete selection.

This is very important, for example, to synchronize a customized button bar with the current formatting of the selected text like bold or italic.

Possible attributes are:

  • Baseline: Specifies the attribute set through the Baseline property.
  • Bold: Specifies the attribute set through the Bold property.
  • FontName: Specifies the attribute set through the FontName property.
  • FontSize: Specifies the attribute set through the FontSize property.
  • ForeColor: Specifies the attribute set through the ForeColor property.
  • FormattingStyle: Specifies the attribute set through the FormattingStyle property.
  • Italic: Specifies the attribute set through the Italic property.
  • Strikeout: Specifies the attribute set through the Strikeout property.
  • TextBackColor: Specifies the attribute set through the TextBackColor property.
  • Underline: Specifies the attribute set through the Underline property.

The following VB.NET code return true, if the complete selection is formatted in bold.

Dim IsSelected As Boolean = TextControl1.Selection.IsCommonValueSelected(TXTextControl.Selection.Attribute.Bold)
 
 
User Contributed Note

User Contributed Note by Markon March 2, 2006 at 5:20:48 PM CET

Can't see the code! Need some one to format the textbox that contains the code so we can see it.