Back to Devexpress

UnboundSource Class

corelibraries-devexpress-dot-data-228b6d7e.md

latest3.8 KB
Original Source

UnboundSource Class

A data source used to supply and obtain a typed list of objects to data-aware controls in unbound mode.

Namespace : DevExpress.Data

Assembly : DevExpress.Data.v25.2.dll

NuGet Package : DevExpress.Data

Declaration

csharp
[ToolboxBitmap(typeof(ResFinder), "Bitmaps256.UnboundDataSource.bmp")]
public class UnboundSource :
    Component,
    IListSource,
    ISupportInitialize
vb
<ToolboxBitmap(GetType(ResFinder), "Bitmaps256.UnboundDataSource.bmp")>
Public Class UnboundSource
    Inherits Component
    Implements IListSource,
               ISupportInitialize

Remarks

To use the UnboundSource component, drag it to the form from the DX.25.2: Data & Analytics tab of the Visual Studio Toolbox. You can also add and configure an UnboundSource with the Data Source Configuration Wizard.

To setup the UnboundSource ‘s list and its columns, use the UnboundSource.Properties property.

Handle the UnboundSource.ValueNeeded and UnboundSource.ValuePushed events to obtain data from your data storage and save modified data back.

csharp
unboundSource1.ValueNeeded+= unboundSource1_ValueNeeded;
unboundSource1.ValuePushed+= unboundSource1_ValuePushed;
//...
void unboundSource1_ValueNeeded(object sender, DevExpress.Data.UnboundSourceValueNeededEventArgs e) {
    e.Value = something; /* Assign the real data here.*/
}
void unboundSource1_ValuePushed(object sender, DevExpress.Data.UnboundSourceValuePushedEventArgs e) {
    something = e.Value; /* Propagate the value into the storage.*/
}
vb
AddHandler unboundSource1.ValueNeeded, AddressOf unboundSource1_ValueNeeded
AddHandler unboundSource1.ValuePushed, AddressOf unboundSource1_ValuePushed
'...
Private Sub unboundSource1_ValueNeeded(ByVal sender As Object, ByVal e As DevExpress.Data.UnboundSourceValueNeededEventArgs)
    e.Value = something ' Assign the real data here.
End Sub
Private Sub unboundSource1_ValuePushed(ByVal sender As Object, ByVal e As DevExpress.Data.UnboundSourceValuePushedEventArgs)
    something = e.Value ' Propagate the value into the storage.
End Sub

Use the UnboundSource methods (UnboundSource.Add, UnboundSource.Move, UnboundSource.InsertAt, UnboundSource.RemoveAt, etc.) to notify the bound control that the data is changed.

Inheritance

Object MarshalByRefObject Component UnboundSource

See Also

UnboundSource Members

DevExpress.Data Namespace