Uređivanje

Dijeli putem


Control.DataContext Property

Definition

Gets or sets the data context for the purpose of data binding. This is an ambient property.

public:
 virtual property System::Object ^ DataContext { System::Object ^ get(); void set(System::Object ^ value); };
[System.ComponentModel.Bindable(true)]
[System.ComponentModel.Browsable(false)]
public virtual object? DataContext { get; set; }
[<System.ComponentModel.Bindable(true)>]
[<System.ComponentModel.Browsable(false)>]
member this.DataContext : obj with get, set
Public Overridable Property DataContext As Object

Property Value

Attributes

Remarks

Data context is a concept that allows elements to inherit information from their parent elements about the data source that is used for binding. It's the duty of deriving controls which inherit from this class to handle the provided data source accordingly. For example, UserControls, which use BindingSource components for data binding scenarios could either handle the DataContextChanged event or override OnDataContextChanged(EventArgs) to provide the relevant data from the data context to a BindingSource component's DataSource.

Applies to