BindingBase.ProvideValue Method

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

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

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



The object that can provide services for the markup extension. May be a null reference (Nothing in Visual Basic); see the Remarks section later in this topic for more information.

Return Value

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 subclasses (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 subclasses, as implemented by having the base class call an internal abstract method. Otherwise, the extension will return the binding object itself. Returning the binding itself will result in a type mismatch error, but this should not occur under normal circumstances.


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, it is not practical to derive custom binding classes from BindingBase that will function correctly as a XAML markup extension.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0