Class DataSource
DataSource is a non UI component that consumes raw data and processes data operations such as sorting, filtering and grouping. This can be applied to any data bound control to perform the data processing and data operations which saving developers time and effort in building the functionality themselves.
Implements
Inherited Members
Namespace: Syncfusion.DataSource
Assembly: Syncfusion.DataSource.WinForms.dll
Syntax
public class DataSource : IDisposable
Constructors
DataSource()
Initializes a new instance of the DataSource class.
Declaration
public DataSource()
Fields
editItem
Store the object for editing and commit the value to underlying source after editing completed.
Declaration
protected object editItem
Field Value
| Type |
|---|
| System.Object |
isInCommitEdit
Commits the edited object to the underlying source
Declaration
protected bool isInCommitEdit
Field Value
| Type |
|---|
| System.Boolean |
isInEndeferal
Notify to wire and unwire the property changed event whenever the underlying collection changed.
Declaration
protected bool isInEndeferal
Field Value
| Type |
|---|
| System.Boolean |
Properties
AutoExpandGroups
Gets or sets a value indicating whether groups has to expand automatically or not.
Declaration
public bool AutoExpandGroups { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
CanAddNew
Gets a value indicating whether new object can be added or not
Declaration
public virtual bool CanAddNew { get; }
Property Value
| Type |
|---|
| System.Boolean |
CanCancelEdit
Gets a value indicating whether editing can be cancelled or not
Declaration
public bool CanCancelEdit { get; }
Property Value
| Type |
|---|
| System.Boolean |
CanRemove
Gets a value indicating whether object can be removed from source
Declaration
public bool CanRemove { get; }
Property Value
| Type |
|---|
| System.Boolean |
CurrentAddItem
Gets or sets the currently added item.
Declaration
public object CurrentAddItem { get; set; }
Property Value
| Type |
|---|
| System.Object |
CurrentEditItem
Gets current editing item
Declaration
public object CurrentEditItem { get; }
Property Value
| Type |
|---|
| System.Object |
DisplayItems
Gets the list of items to be displayed
Declaration
public DisplayItems DisplayItems { get; }
Property Value
| Type | Description |
|---|---|
| DisplayItems | The display items. |
Filter
Gets or sets the filter for the underlying collection
Declaration
public Predicate<object> Filter { get; set; }
Property Value
| Type |
|---|
| System.Predicate<System.Object> |
FilterPredicates
Gets or sets the filter predicates.
Declaration
public ObservableCollection<IFilterDefinition> FilterPredicates { get; set; }
Property Value
| Type |
|---|
| System.Collections.ObjectModel.ObservableCollection<IFilterDefinition> |
GroupComparer
Gets or sets the GroupComparer.This will be considered when comparer in GroupDescriptor is null.
Declaration
public IComparer<GroupResult> GroupComparer { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IComparer<GroupResult> | IComparer of GroupResult. |
GroupDescriptors
Gets the collection of group descriptors.
Declaration
public ObservableCollection<GroupDescriptor> GroupDescriptors { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.ObjectModel.ObservableCollection<GroupDescriptor> | The group descriptor. |
Groups
Gets the list of groups
Declaration
public GroupList Groups { get; }
Property Value
| Type | Description |
|---|---|
| GroupList | The Group List. |
IsAddingNew
Gets a value indicating whether adding new object or not
Declaration
public bool IsAddingNew { get; }
Property Value
| Type |
|---|
| System.Boolean |
IsDynamicBound
Gets or sets a value indicating whether this instance is dynamic bound.
Declaration
public bool IsDynamicBound { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | true if this instance is dynamic bound; otherwise, false. |
IsEditingItem
Gets a value indicating whether is in editing or not
Declaration
public bool IsEditingItem { get; }
Property Value
| Type |
|---|
| System.Boolean |
Items
Gets the list of items. Contains filtered data
Declaration
public IList<object> Items { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IList<System.Object> | The List of items. |
LiveDataUpdateMode
Gets or sets the live data update mode of the DataSource.
Declaration
public LiveDataUpdateMode LiveDataUpdateMode { get; set; }
Property Value
| Type | Description |
|---|---|
| LiveDataUpdateMode | The live data update mode. |
SortComparer
Gets or sets the SortComparer.This will be considered when comparer in SortDescriptor is null.
Declaration
public IComparer<object> SortComparer { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IComparer<System.Object> | IComparer of object. |
SortDescriptors
Gets the collection of sort descriptors.
Declaration
public ObservableCollection<SortDescriptor> SortDescriptors { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.ObjectModel.ObservableCollection<SortDescriptor> | The collection of sort descriptor. |
Source
Gets or sets the Source of the DataSource.
Declaration
public IEnumerable Source { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.IEnumerable | The source. |
SourceType
Gets or sets the source type of the underlying source
Declaration
public Type SourceType { get; set; }
Property Value
| Type |
|---|
| System.Type |
Methods
AddNew()
Adds the new object of source type to source
Declaration
public virtual object AddNew()
Returns
| Type | Description |
|---|---|
| System.Object | The object added object |
BeginInit()
Suspend the events and initiate changes
Declaration
public void BeginInit()
CancelEdit()
Cancel the the editing
Declaration
public void CancelEdit()
CancelNew()
Removes the added item
Declaration
public virtual void CancelNew()
CommitEdit()
Commit the editing of object.
Declaration
public virtual void CommitEdit()
CommitNew()
Commits the newly added object to source
Declaration
public virtual void CommitNew()
DeferRefresh()
Refresh the DataSource and halt
Declaration
public IDisposable DeferRefresh()
Returns
| Type | Description |
|---|---|
| System.IDisposable | Represents the IDispose. |
Dispose()
Disposes all available resources.
Declaration
public void Dispose()
Dispose(Boolean)
Dispose the instances, if parameter is true.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing | Represents the boolean value for disposing objects |
EditItem(Object)
Initiates the editing of an item
Declaration
public void EditItem(object item)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | item | Item to edit |
EndEdit()
End the editing of object
Declaration
public virtual void EndEdit()
EndInit()
End Suspending events and changes and deferRefresh the DataSource.
Declaration
public void EndInit()
GetActiveComparer()
Helper method to get the active comparer object.
Declaration
protected IComparer<object> GetActiveComparer()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IComparer<System.Object> | Returns the comparer object. |
GetItemAt(Int32)
Returns the item in the index
Declaration
public virtual object GetItemAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | The index of the item |
Returns
| Type | Description |
|---|---|
| System.Object | Returns the item in the index. |
GetSourceListCollection()
Returns the IList of source.
Declaration
protected IList GetSourceListCollection()
Returns
| Type | Description |
|---|---|
| System.Collections.IList | Returns the IList. |
GetValue(Object, String)
Gets the value of property from the given object
Declaration
protected virtual object GetValue(object item, string propertyName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | item | The object |
| System.String | propertyName | Property name |
Returns
| Type | Description |
|---|---|
| System.Object | The value |
NotifyPropertyChangedHandler(Object, PropertyChangedEventArgs)
Handles the source property change
Declaration
protected virtual void NotifyPropertyChangedHandler(object sender, PropertyChangedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | sender | The object. |
| System.ComponentModel.PropertyChangedEventArgs | e | Represents the System.ComponentModel.PropertyChangedEventArgs |
Refresh()
Refreshes the DataSource
Declaration
public void Refresh()
RefreshFilter()
Refresh the DataSource. Raises the FilterChanged Event
Declaration
public virtual void RefreshFilter()
SetActiveComparer()
Helper method to initialize the comparer object.
Declaration
protected void SetActiveComparer()
Events
FilterChanged
Occurs when filter changed
Declaration
public event NotifyCollectionChangedEventHandler FilterChanged
Event Type
| Type |
|---|
| System.Collections.Specialized.NotifyCollectionChangedEventHandler |
SourceCollectionChanged
Occurs when source collection changed
Declaration
public event NotifyCollectionChangedEventHandler SourceCollectionChanged
Event Type
| Type |
|---|
| System.Collections.Specialized.NotifyCollectionChangedEventHandler |
SourcePropertyChanged
Occurs when source property Changed
Declaration
public event PropertyChangedEventHandler SourcePropertyChanged
Event Type
| Type |
|---|
| System.ComponentModel.PropertyChangedEventHandler |