ObjectDataProvider ObjectDataProvider ObjectDataProvider ObjectDataProvider Class

Definition

Wraps and creates an object that you can use as a binding source.

public ref class ObjectDataProvider : System::Windows::Data::DataSourceProvider
[System.Windows.Localizability(System.Windows.LocalizationCategory.NeverLocalize)]
public class ObjectDataProvider : System.Windows.Data.DataSourceProvider
type ObjectDataProvider = class
    inherit DataSourceProvider
Public Class ObjectDataProvider
Inherits DataSourceProvider
Inheritance
ObjectDataProviderObjectDataProviderObjectDataProviderObjectDataProvider
Attributes

Remarks

Important

ObjectDataProvider fails when it does not have permissions to perform reflection on the given type or member. For more information, see Permissions Requirements in Binding Sources Overview.

There are many ways to create an object to use as a binding source. For example, you can create your object in the resources section of your Extensible Application Markup Language (XAML) page, or you can create your object in code and set it as the DataContext of your window.

ObjectDataProvider enables you to create your object in XAML and make it available as a binding source. It provides the following properties that enable you to execute a query on your object and bind to the results.

  • Use the ConstructorParameters property to pass parameters to the constructor of your object.

  • Use the MethodName property to call a method and use the MethodParameters property to pass parameters to the method. You can then bind to the results of the method.

You can also use the IsAsynchronous property to specify whether to perform object creation in a worker thread or in the active context.

This class is also useful when you want to replace your current binding source object with another object and have all the associated bindings updated.

ObjectDataProvider provides a convenient way to create and use objects as binding source objects in XAML, but it does not replace existing data models.

If you are implementing your own objects for data binding, see Binding Sources Overview for information and recommendations.

Constructors

ObjectDataProvider() ObjectDataProvider() ObjectDataProvider() ObjectDataProvider()

Initializes a new instance of the ObjectDataProvider class.

Properties

ConstructorParameters ConstructorParameters ConstructorParameters ConstructorParameters

Gets the list of parameters to pass to the constructor.

Data Data Data Data

Gets the underlying data object.

(Inherited from DataSourceProvider)
Dispatcher Dispatcher Dispatcher Dispatcher

Gets or sets the current Dispatcher object to the UI thread to use.

(Inherited from DataSourceProvider)
Error Error Error Error

Gets the error of the last query operation.

(Inherited from DataSourceProvider)
IsAsynchronous IsAsynchronous IsAsynchronous IsAsynchronous

Gets or sets a value that indicates whether to perform object creation in a worker thread or in the active context.

IsInitialLoadEnabled IsInitialLoadEnabled IsInitialLoadEnabled IsInitialLoadEnabled

Gets or sets a value that indicates whether to prevent or delay the automatic loading of data.

(Inherited from DataSourceProvider)
IsRefreshDeferred IsRefreshDeferred IsRefreshDeferred IsRefreshDeferred

Gets a value that indicates whether there is an outstanding DeferRefresh() in use.

(Inherited from DataSourceProvider)
MethodName MethodName MethodName MethodName

Gets or sets the name of the method to call.

MethodParameters MethodParameters MethodParameters MethodParameters

Gets the list of parameters to pass to the method.

ObjectInstance ObjectInstance ObjectInstance ObjectInstance

Gets or sets the object used as the binding source.

ObjectType ObjectType ObjectType ObjectType

Gets or sets the type of object to create an instance of.

Methods

BeginInit() BeginInit() BeginInit() BeginInit()

Indicates that initialization of this object is about to begin; no implicit Refresh() occurs until the matched EndInit() method is called.

(Inherited from DataSourceProvider)
BeginQuery() BeginQuery() BeginQuery() BeginQuery()

Starts to create the requested object, either immediately or on a background thread, based on the value of the IsAsynchronous property.

DeferRefresh() DeferRefresh() DeferRefresh() DeferRefresh()

Enters a defer cycle that you can use to change properties of the provider and delay automatic refresh.

(Inherited from DataSourceProvider)
EndInit() EndInit() EndInit() EndInit()

Indicates that the initialization of this object has completed; this causes a Refresh() if no other DeferRefresh() is outstanding.

(Inherited from DataSourceProvider)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
InitialLoad() InitialLoad() InitialLoad() InitialLoad()

Starts the initial query to the underlying data model. The result is returned on the Data property.

(Inherited from DataSourceProvider)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnPropertyChanged(PropertyChangedEventArgs) OnPropertyChanged(PropertyChangedEventArgs) OnPropertyChanged(PropertyChangedEventArgs) OnPropertyChanged(PropertyChangedEventArgs)

Raises the PropertyChanged event with the provided arguments.

(Inherited from DataSourceProvider)
OnQueryFinished(Object) OnQueryFinished(Object) OnQueryFinished(Object) OnQueryFinished(Object)

Derived classes call this method to indicate that a query has finished.

(Inherited from DataSourceProvider)
OnQueryFinished(Object, Exception, DispatcherOperationCallback, Object) OnQueryFinished(Object, Exception, DispatcherOperationCallback, Object) OnQueryFinished(Object, Exception, DispatcherOperationCallback, Object) OnQueryFinished(Object, Exception, DispatcherOperationCallback, Object)

Derived classes call this method to indicate that a query has finished.

(Inherited from DataSourceProvider)
Refresh() Refresh() Refresh() Refresh()

Initiates a refresh operation to the underlying data model. The result is returned on the Data property.

(Inherited from DataSourceProvider)
ShouldSerializeConstructorParameters() ShouldSerializeConstructorParameters() ShouldSerializeConstructorParameters() ShouldSerializeConstructorParameters()

Indicates whether the ConstructorParameters property should be persisted.

ShouldSerializeMethodParameters() ShouldSerializeMethodParameters() ShouldSerializeMethodParameters() ShouldSerializeMethodParameters()

Indicates whether the MethodParameters property should be persisted.

ShouldSerializeObjectInstance() ShouldSerializeObjectInstance() ShouldSerializeObjectInstance() ShouldSerializeObjectInstance()

Indicates whether the ObjectInstance property should be persisted.

ShouldSerializeObjectType() ShouldSerializeObjectType() ShouldSerializeObjectType() ShouldSerializeObjectType()

Indicates whether the ObjectType property should be persisted.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Events

DataChanged DataChanged DataChanged DataChanged

Occurs when the Data property has a new value.

(Inherited from DataSourceProvider)
INotifyPropertyChanged.PropertyChanged INotifyPropertyChanged.PropertyChanged INotifyPropertyChanged.PropertyChanged INotifyPropertyChanged.PropertyChanged

Occurs when a property value changes.

(Inherited from DataSourceProvider)
PropertyChanged PropertyChanged PropertyChanged PropertyChanged

Occurs when a property value changes.

(Inherited from DataSourceProvider)

Explicit Interface Implementations

ISupportInitialize.BeginInit() ISupportInitialize.BeginInit() ISupportInitialize.BeginInit() ISupportInitialize.BeginInit()

This member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

(Inherited from DataSourceProvider)
ISupportInitialize.EndInit() ISupportInitialize.EndInit() ISupportInitialize.EndInit() ISupportInitialize.EndInit()

This member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

(Inherited from DataSourceProvider)

Applies to

See also