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:
virtual Object^ ProvideValue(
	IServiceProvider^ serviceProvider
) override sealed

Parameters

serviceProvider
Type: System::IServiceProvider
The object that can provide services for the markup extension. May be nullptr; 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

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.

.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.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2015 Microsoft