Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

TextBoxBase::SelectionOpacity Property

Gets or sets the opacity of the SelectionBrush.

Namespace:  System.Windows.Controls.Primitives
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
public:
property double SelectionOpacity {
	double get ();
	void set (double value);
}
<object SelectionOpacity="double" .../>

Property Value

Type: System::Double
The opacity of the SelectionBrush. The default is 0.4.

If SelectionOpacity is set to 0, the SelectionBrush is transparent and is not visible. If SelectionOpacity is set to 1.0 or greater, the SelectionBrush is opaque and the selected text is not visible.

The following example creates a TextBox and adds the text, "This is some text." The example sets the SelectionBrush property to red and the SelectionOpacity property to 0.5 to customize the appearance of selected text.


<TextBox SelectionBrush="Red" SelectionOpacity="0.5"
         Foreground="Blue" CaretBrush="Blue">  
  This is some text.
</TextBox>


The following illustration shows the TextBox from the preceding example with its text selected.

Selected text in a TextBox with SelectionOpacity set to 0.5

TextBox with a red SelectionBrush

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.