This documentation is archived and is not being maintained.

BindingBase.ProvideValue Method

Returns an object that should be set on the property where this binding and extension are applied.

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

public override sealed Object ProvideValue(
	IServiceProvider serviceProvider
)
You cannot use methods in XAML.

Parameters

serviceProvider
Type: System.IServiceProvider

The object that can provide services for the markup extension. May be null; see the Remarks section for more information.

Return Value

Type: System.Object
The value to set on the binding target property.

This implementation provides the base syntax support for binding through Extensible Application Markup Language (XAML) for all provided practical derived classes (Binding, PriorityBinding, and MultiBinding).

The BindingBase class implementation of this method is expected to return an expression object that is the result of a binding. Binding a property works by targeting a given DependencyProperty on a given DependencyObject. These two pieces of information are transmitted by querying for an IProvideValueTarget implementation on the serviceProvider, which the WPF XAML reader makes available during parsing of a binding. This base class implementation is responsible for checking for a valid DependencyProperty and DependencyObject. If these are found, the actual implementation of returning a binding expression falls to various derived classes, as implemented by having the base class call an internal abstract method. Otherwise, the extension returns the binding object itself. Returning the binding itself results in a type mismatch error, but this should not occur under normal circumstances.

Important noteImportant Note:

Because the syntax for binding through XAML as implemented in this method relies on implementing an internal override, and because BindingBase.ProvideValue itself is sealed, a custom binding class that derives from BindingBase will not function correctly as a XAML markup extension.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Show: