Class
DataControl

Represents a control that provides common functionality for all Telerik WPF controls that represent data.

Definition

Namespace:Telerik.Windows.Controls

Assembly:Telerik.Windows.Data.dll

Syntax:

cs-api-definition
public abstract class DataControl : Control, INotifyPropertyChanged

Inheritance: objectDataControl

Derived Classes: BaseItemsControlRadCarousel

Implements: INotifyPropertyChanged

Constructors

DataControl()

Initializes a new instance of the DataControl class.

Declaration

cs-api-definition
protected DataControl()

Fields

CanUserSelectProperty

Identifies the CanUserSelect dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty CanUserSelectProperty

Field Value

DependencyProperty

CurrentItemProperty

Identifies the CurrentItem dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty CurrentItemProperty

Field Value

DependencyProperty

IsSynchronizedWithCurrentItemProperty

Identifies the IsSynchronizedWithCurrentItem dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty IsSynchronizedWithCurrentItemProperty

Field Value

DependencyProperty

ItemsSourceProperty

Identifies the ItemsSource dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty ItemsSourceProperty

Field Value

DependencyProperty

SelectedItemProperty

Identifies the SelectedItem dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty SelectedItemProperty

Field Value

DependencyProperty

SelectionChangedEvent

Identifies the SelectionChanged routed event.

Declaration

cs-api-definition
public static readonly RoutedEvent SelectionChangedEvent

Field Value

RoutedEvent

SelectionChangingEvent

Identifies the SelectionChanging routed event.

Declaration

cs-api-definition
public static readonly RoutedEvent SelectionChangingEvent

Field Value

RoutedEvent

Properties

CanUserSelect

Gets or sets a value indicating whether the user can select rows.

Declaration

cs-api-definition
public bool CanUserSelect { get; set; }

Property Value

bool

true if user can select; otherwise, false.

CurrentItem

Gets the data item bound to the row that contains the current cell.

Declaration

cs-api-definition
public object CurrentItem { get; set; }

Property Value

object

The data item bound to the row that contains the current cell.

IsSynchronizedWithCurrentItem

Gets or sets a value that indicates whether DataControl should keep the SelectedItem synchronized with its CurrentItem property.

Declaration

cs-api-definition
[TypeConverter(typeof(NullableBoolConverter))]
public bool? IsSynchronizedWithCurrentItem { get; set; }

Property Value

bool?

True if the SelectedItem is always synchronized with the current item; false if the SelectedItem is never synchronized; null if the SelectedItem is synchronized with the current item only if a CollectionView is used.

Items

Items is the collection of data that is used to generate the content of this control.

Declaration

cs-api-definition
public DataItemCollection Items { get; }

Property Value

DataItemCollection

ItemsSource

Gets or sets a collection that is used to generate the content of the control.

Declaration

cs-api-definition
public object ItemsSource { get; set; }

Property Value

object

The collection that is used to generate the content of the control. The default is null.

SelectedItem

Gets or sets the data item corresponding to the selected row.

Declaration

cs-api-definition
public object SelectedItem { get; set; }

Property Value

object

The data item corresponding to the selected row.

Remarks

If the SelectionMode property is set to Extended and multiple rows are selected, use the SelectedItems property to retrieve all selected items.

SelectedItems

Gets a collection that contains the data items corresponding to the selected rows.

Declaration

cs-api-definition
public ObservableCollection<object> SelectedItems { get; }

Property Value

ObservableCollection<object>

A collection of the data items corresponding to the selected rows.

Remarks

If the SelectionMode property is set to Single, the SelectedItems list will contain only the SelectedItem property value.

ShouldHandleSelection

Gets a value indicating whether this instance handles selection events and participates in the selection mechanism.

Declaration

cs-api-definition
protected virtual bool ShouldHandleSelection { get; }

Property Value

bool

true if handles selection; otherwise, false.

TableDefinition

Gets the TableDefinition object for the current record collection.

Declaration

cs-api-definition
public TableDefinition TableDefinition { get; }

Property Value

TableDefinition

Methods

CreateTableDefinition()

Creates the specific table definition for the DataControl.

Declaration

cs-api-definition
protected virtual TableDefinition CreateTableDefinition()

Returns

TableDefinition

The newly created TableDefinition.

InitializeSelection()

Initializes the selection.

Declaration

cs-api-definition
protected virtual void InitializeSelection()

OnCanUserSelectChanged(bool, bool)

Called when property CanUserSelect changes.

Declaration

cs-api-definition
protected virtual void OnCanUserSelectChanged(bool oldValue, bool newValue)

Parameters

oldValue

bool

Old property value.

newValue

bool

New property value.

OnCurrentItemChanged()

Called when the current item of the DataControl is changed.

Declaration

cs-api-definition
protected virtual void OnCurrentItemChanged()

OnItemsCollectionChanged(object, NotifyCollectionChangedEventArgs)

Called when this.Items collection changes.

Declaration

cs-api-definition
protected virtual void OnItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)

Parameters

sender

object

The sender.

e

NotifyCollectionChangedEventArgs

The NotifyCollectionChangedEventArgs instance containing the event data.

OnItemsPropertyChanged(object, PropertyChangedEventArgs)

Called when this.Items has a property changed.

Declaration

cs-api-definition
protected virtual void OnItemsPropertyChanged(object sender, PropertyChangedEventArgs e)

Parameters

sender

object

The sender.

e

PropertyChangedEventArgs

The PropertyChangedEventArgs instance containing the event data.

OnItemsSourceChanged(object, object)

Called when ItemsSource property has changed.

Declaration

cs-api-definition
protected virtual void OnItemsSourceChanged(object oldValue, object newValue)

Parameters

oldValue

object

The old value.

newValue

object

The new value.

OnPropertyChanged(string)

Called when a property changes.

Declaration

cs-api-definition
protected virtual void OnPropertyChanged(string propertyName)

Parameters

propertyName

string

Name of the property.

OnSelectedItemChanged(object, object)

Called when the selected item of the DataControl is changed.

Declaration

cs-api-definition
protected virtual void OnSelectedItemChanged(object oldItem, object newItem)

Parameters

oldItem

object

newItem

object

OnSelectionChanging(SelectionChangingEventArgs)

Raises the SelectionChangingEvent event.

Declaration

cs-api-definition
protected virtual void OnSelectionChanging(SelectionChangingEventArgs args)

Parameters

args

SelectionChangingEventArgs

The SelectionChangingEventArgs instance containing the event data.

RaiseSelectionChangedEvent(SelectionChangeEventArgs)

Raises the selection changed event.

Declaration

cs-api-definition
protected virtual void RaiseSelectionChangedEvent(SelectionChangeEventArgs args)

Parameters

args

SelectionChangeEventArgs

The SelectionChangeEventArgs instance containing the event data.

Rebind()

Rebinds the grid.

Declaration

cs-api-definition
public void Rebind()

SetIsCurrent(object, bool)

Sets the current state for a container that wraps a given data item.

Declaration

cs-api-definition
protected abstract void SetIsCurrent(object item, bool isCurrent)

Parameters

item

object

The data item.

isCurrent

bool

If set to true container is current.

SetIsSelected(object, bool)

Sets the selection state for a container that wraps a given data item.

Declaration

cs-api-definition
protected abstract void SetIsSelected(object item, bool isSelected)

Parameters

item

object

The data item.

isSelected

bool

If set to true container is selected.

Events

PropertyChanged

Occurs when a property value changes.

Declaration

cs-api-definition
public event PropertyChangedEventHandler PropertyChanged

Event Value

PropertyChangedEventHandler

Implements INotifyPropertyChanged.PropertyChanged

SelectionChanged

Occurs when the selected items have changed.

Declaration

cs-api-definition
public event EventHandler<SelectionChangeEventArgs> SelectionChanged

Event Value

EventHandler<SelectionChangeEventArgs>

SelectionChanging

Occurs when the selected items are about to change.

Declaration

cs-api-definition
public event EventHandler<SelectionChangingEventArgs> SelectionChanging

Event Value

EventHandler<SelectionChangingEventArgs>