TextRange.GetPropertyValue Method (DependencyProperty)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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.

Exception Condition

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
Available since 3.0
Return to top