Class BindingProviderBase<T>
Represents a base class for data binding providers that facilitate two-way data binding between scheduler items and external data sources, providing mapping capabilities and change tracking.
Inheritance
Namespace: Telerik.WinControls.UI.Scheduler
Assembly: Telerik.WinControls.Scheduler.dll
Syntax
public abstract class BindingProviderBase<T> : BindingSource, ISchedulerProvider<T> where T : IDataBoundItem
Type Parameters
T
The type of scheduler item that implements IDataBoundItem. |
Constructors
BindingProviderBase(SchedulerBindingDataSource)
Initializes a new instance of the BindingProviderBase<T> class with the specified data source owner.
Declaration
protected BindingProviderBase(SchedulerBindingDataSource owner)
Parameters
SchedulerBindingDataSource
owner
The SchedulerBindingDataSource that owns this binding provider. |
Fields
schedulerItems
Declaration
protected List<T> schedulerItems
Field Value
System.Collections.Generic.List<T>
|
Properties
Mapping
Gets or sets the mapping information that defines how properties of scheduler items correspond to properties in the data source, enabling bidirectional data binding.
Declaration
public virtual IMappingInfo Mapping { get; set; }
Property Value
IMappingInfo
|
Implements
TrackDataSourceChanges
Gets or sets a value indicating whether changes to the underlying data source should be tracked and synchronized with scheduler items.
Declaration
public bool TrackDataSourceChanges { get; set; }
Property Value
System.Boolean
|
Methods
CreateInstance()
When overridden in a derived class, creates a new instance of the specific scheduler item type.
Declaration
protected abstract T CreateInstance()
Returns
T
A new instance of type |
Delete(T)
Deletes a scheduler item from the data source and removes it from the scheduler items collection.
Declaration
public virtual void Delete(T itemToDelete)
Parameters
T
itemToDelete
The scheduler item to delete from the data source. |
Implements
DeleteCore(T)
Performs the core deletion logic for removing a scheduler item from the data source.
Declaration
protected virtual void DeleteCore(T itemToDelete)
Parameters
T
itemToDelete
The scheduler item to delete. |
FindDataSourceProperty(SchedulerMapping)
Finds a property descriptor in the data source properties collection that matches the specified mapping.
Declaration
protected PropertyDescriptor FindDataSourceProperty(SchedulerMapping mapping)
Parameters
SchedulerMapping
mapping
The scheduler mapping that defines the data source property to find. |
Returns
System.ComponentModel.PropertyDescriptor
The System.ComponentModel.PropertyDescriptor for the data source property, or null if not found. |
GetItems(Predicate<T>)
Retrieves scheduler items from the data source, optionally applying a filter function.
Declaration
public IEnumerable<T> GetItems(Predicate<T> filterFunction)
Parameters
System.Predicate<T>
filterFunction
An optional filter function to apply when retrieving items. If null, all items are returned. |
Returns
System.Collections.Generic.IEnumerable<T>
An enumerable collection of scheduler items of type |
Implements
GetSourcePropertyName(PropertyDescriptor)
Gets the name of a data source property, allowing for custom property name transformations. Override this method to implement custom property naming strategies.
Declaration
protected virtual string GetSourcePropertyName(PropertyDescriptor property)
Parameters
System.ComponentModel.PropertyDescriptor
property
The property descriptor for which to get the name. |
Returns
System.String
The name to use for the property in data binding operations. |
Insert(T)
Inserts a new scheduler item into the data source and synchronizes the change with the underlying data store.
Declaration
public virtual void Insert(T itemToInsert)
Parameters
T
itemToInsert
The scheduler item to insert into the data source. |
Implements
InsertCore(T)
Performs the core insertion logic for adding a scheduler item to the data source.
Declaration
protected virtual void InsertCore(T itemToInsert)
Parameters
T
itemToInsert
The scheduler item to insert. |
OnCreateSchedulerItemsBegin(PropertyDescriptorCollection)
Called before the process of extracting scheduler items from the data source begins. Override this method to perform initialization or preparation tasks.
Declaration
protected virtual void OnCreateSchedulerItemsBegin(PropertyDescriptorCollection properties)
Parameters
System.ComponentModel.PropertyDescriptorCollection
properties
The collection of properties available on the data source items. |
OnCreateSchedulerItemsEnd()
Called after the process of extracting scheduler items from the data source completes. Override this method to perform cleanup or finalization tasks.
Declaration
protected virtual void OnCreateSchedulerItemsEnd()
OnDataMemberChanged(EventArgs)
Raises the System.Windows.Forms.BindingSource.DataMemberChanged event and updates the data properties cache.
Declaration
protected override void OnDataMemberChanged(EventArgs e)
Parameters
System.EventArgs
e
An System.EventArgs that contains the event data. |
OnDataSourceChanged(EventArgs)
Raises the System.Windows.Forms.BindingSource.DataSourceChanged event and updates the data properties cache.
Declaration
protected override void OnDataSourceChanged(EventArgs e)
Parameters
System.EventArgs
e
An System.EventArgs that contains the event data. |
OnItemsChanged(ListChangedEventArgs<T>)
Raises the ItemsChanged event to notify subscribers of changes to the scheduler items collection.
Declaration
protected virtual void OnItemsChanged(ListChangedEventArgs<T> args)
Parameters
ListChangedEventArgs<T>
args
The ListChangedEventArgs<T> instance containing the event data. |
OnListChanged(ListChangedEventArgs)
Raises the System.Windows.Forms.BindingSource.ListChanged event and handles synchronization between the data source and scheduler items.
Declaration
protected override void OnListChanged(ListChangedEventArgs e)
Parameters
System.ComponentModel.ListChangedEventArgs
e
A System.ComponentModel.ListChangedEventArgs that contains the event data. |
ProcessDataSourceValue(T, SchedulerMapping, Object)
Called to process a value from the data source when the corresponding scheduler item property cannot be found or when custom processing is required. Override this method to handle complex mappings.
Declaration
protected virtual void ProcessDataSourceValue(T schedulerItem, SchedulerMapping mapping, object value)
Parameters
T
schedulerItem
The scheduler item being populated. |
SchedulerMapping
mapping
The mapping configuration for the current property. |
System.Object
value
The value from the data source that needs processing. |
ProcessSchedulerItem(T, Object, SchedulerMapping, PropertyDescriptor)
Called to process a scheduler item value when updating the data source and custom processing is required. Override this method to handle complex mappings during data source updates.
Declaration
protected virtual void ProcessSchedulerItem(T schedulerItem, object dataSourceItem, SchedulerMapping mapping, PropertyDescriptor dataItemProperty)
Parameters
T
schedulerItem
The scheduler item containing the source value. |
System.Object
dataSourceItem
The data source item being updated. |
SchedulerMapping
mapping
The mapping configuration for the current property. |
System.ComponentModel.PropertyDescriptor
dataItemProperty
The property descriptor for the data source property being updated. |
ReadSchedulerItem(T, Object)
Populates a scheduler item with data from the corresponding data source item using the configured property mappings.
Declaration
protected virtual void ReadSchedulerItem(T schedulerItem, object item)
Parameters
T
schedulerItem
The scheduler item to populate with data. |
System.Object
item
The data source item containing the source data. |
ShouldApplyMapping(SchedulerMapping)
Determines whether a specific mapping should be applied during data binding operations. Override this method to implement conditional mapping logic.
Declaration
protected virtual bool ShouldApplyMapping(SchedulerMapping mapping)
Parameters
SchedulerMapping
mapping
The scheduler mapping to evaluate. |
Returns
System.Boolean
true if the mapping should be applied; otherwise, false. |
ShouldReadDataItem(Object)
Determines whether a specific data source item should be processed and converted to a scheduler item. Override this method to implement custom filtering logic during data source enumeration.
Declaration
protected virtual bool ShouldReadDataItem(object item)
Parameters
System.Object
item
The data source item to evaluate. |
Returns
System.Boolean
true if the item should be processed; otherwise, false. |
Update(T, String)
Updates an existing scheduler item in the data source with new property values.
Declaration
public virtual void Update(T itemToUpdate, string propertyName)
Parameters
T
itemToUpdate
The scheduler item to update in the data source. |
System.String
propertyName
The name of the specific property that changed, or null/empty to update all properties. |
Implements
UpdateChildItems()
Updates any child or related items after a modification operation. Override this method to provide custom child item synchronization logic.
Declaration
protected virtual void UpdateChildItems()
UpdateCore(T, String)
Performs the core update logic for modifying a scheduler item in the data source.
Declaration
protected virtual void UpdateCore(T itemToUpdate, string propertyName)
Parameters
T
itemToUpdate
The scheduler item to update. |
System.String
propertyName
The name of the specific property that changed, or null/empty to update all properties. |
UpdateDataItem(T, Object, String)
Updates the properties of a data source item with values from the corresponding scheduler item.
Declaration
protected void UpdateDataItem(T itemToUpdate, object dataItem, string propertyName)
Parameters
T
itemToUpdate
The scheduler item containing the source values. |
System.Object
dataItem
The data source item to update. |
System.String
propertyName
The name of the specific property to update, or null/empty to update all properties. |
UpdateDataItemProperties(Object, T)
Updates all mapped properties of a data source item with values from the corresponding scheduler item.
Declaration
protected virtual void UpdateDataItemProperties(object item, T schedulerItem)
Parameters
System.Object
item
The data source item to update. |
T
schedulerItem
The scheduler item containing the source values. |
UpdateDataItemProperty(Object, T, SchedulerMapping)
Updates a specific property of a data source item with the corresponding value from a scheduler item using the provided mapping.
Declaration
protected virtual bool UpdateDataItemProperty(object item, T schedulerItem, SchedulerMapping mapping)
Parameters
System.Object
item
The data source item to update. |
T
schedulerItem
The scheduler item containing the source value. |
SchedulerMapping
mapping
The mapping configuration that defines the property relationship. |
Returns
System.Boolean
true if the property was successfully updated; otherwise, false. |
UpdateDataPropertiesCache()
Updates the cached collection of data source property descriptors based on the current data list.
Declaration
protected void UpdateDataPropertiesCache()
UpdateSchedulerPropertiesCache()
Updates the cached collection of scheduler item property descriptors based on the current scheduler item type.
Declaration
protected void UpdateSchedulerPropertiesCache()
Events
ItemsChanged
Occurs when the scheduler items collection changes due to data source modifications.
Declaration
public event EventHandler<ListChangedEventArgs<T>> ItemsChanged
Event Type
System.EventHandler<ListChangedEventArgs<T>>
|