This documentation is archived and is not being maintained.

TextRange.GetPropertyValue Method

Returns the effective value of a specified formatting property on the current selection.

Namespace:  System.Windows.Documents
Assembly:  PresentationFramework (in PresentationFramework.dll)

public Object GetPropertyValue(
	DependencyProperty formattingProperty


Type: System.Windows.DependencyProperty
A formatting property to get the value of with respect to the current selection.

Return Value

Type: System.Object
An object specifying the value of the specified formatting property.


Occurs when formattingProperty does not specify a valid formatting property, or value specifies an invalid value for formattingProperty.


Occurs when formattingProperty is null.

In order to return a property value, the entire TextRange must extend over text with only one value for the formattingProperty. If the TextRange extends over text with two or more different values for the formattingProperty, UnsetValue is returned.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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.