• Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop
    Web
    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for ASP.NET AJAX UI for ASP.NET MVC UI for ASP.NET Core UI for Blazor UI for Silverlight UI for PHP UI for JSP
    Mobile
    UI for .NET MAUI UI for Xamarin
    Document Management
    Telerik Document Processing
    Desktop
    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF UI for UWP
    Reporting & Mocking
    Telerik Reporting Telerik Report Server Telerik JustMock
    Automated Testing
    Test Studio Test Studio Dev Edition
    CMS
    Sitefinity
    UI/UX Design
    Unite UX
    Debugging
    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Jam FiddlerCap FiddlerCore
    Extended Reality
    UI for Unity XR
    Free Tools
    JustAssembly JustDecompile VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Docs & Support
  • Pricing
  • Search
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class DataControl

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

Inheritance
System.Object
DataControl
BaseItemsControl
RadCarousel
Namespace: Telerik.Windows.Controls
Assembly: Telerik.Windows.Data.dll

Syntax

public abstract class DataControl : Control, INotifyPropertyChanged, ISelectorInternal

Constructors

DataControl()

Initializes a new instance of the DataControl class.

Declaration
protected DataControl()

Fields

CanUserSelectProperty

Identifies the CanUserSelect dependency property.

Declaration
public static readonly DependencyProperty CanUserSelectProperty
Field Value
System.Windows.DependencyProperty

CurrentItemProperty

Identifies the CurrentItem dependency property.

Declaration
public static readonly DependencyProperty CurrentItemProperty
Field Value
System.Windows.DependencyProperty

IsSynchronizedWithCurrentItemProperty

Identifies the IsSynchronizedWithCurrentItem dependency property.

Declaration
public static readonly DependencyProperty IsSynchronizedWithCurrentItemProperty
Field Value
System.Windows.DependencyProperty

ItemsSourceProperty

Identifies the ItemsSource dependency property.

Declaration
public static readonly DependencyProperty ItemsSourceProperty
Field Value
System.Windows.DependencyProperty

SelectedItemProperty

Identifies the SelectedItem dependency property.

Declaration
public static readonly DependencyProperty SelectedItemProperty
Field Value
System.Windows.DependencyProperty

SelectionChangedEvent

Identifies the SelectionChanged routed event.

Declaration
public static readonly RoutedEvent SelectionChangedEvent
Field Value
System.Windows.RoutedEvent

SelectionChangingEvent

Identifies the SelectionChanging routed event.

Declaration
public static readonly RoutedEvent SelectionChangingEvent
Field Value
System.Windows.RoutedEvent

Properties

CanUserSelect

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

Declaration
public bool CanUserSelect { get; set; }
Property Value
System.Boolean

true if user can select; otherwise, false.

CurrentItem

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

Declaration
public object CurrentItem { get; set; }
Property Value
System.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
public bool? IsSynchronizedWithCurrentItem { get; set; }
Property Value
System.Nullable<System.Boolean>

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
public DataItemCollection Items { get; }
Property Value
DataItemCollection

ItemsSource

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

Declaration
public object ItemsSource { get; set; }
Property Value
System.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
public object SelectedItem { get; set; }
Property Value
System.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
public ObservableCollection<object> SelectedItems { get; }
Property Value
System.Collections.ObjectModel.ObservableCollection<System.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
protected virtual bool ShouldHandleSelection { get; }
Property Value
System.Boolean

true if handles selection; otherwise, false.

TableDefinition

Gets the TableDefinition object for the current record collection.

Declaration
public TableDefinition TableDefinition { get; }
Property Value
TableDefinition

Methods

CreateTableDefinition()

Creates the specific table definition for the DataControl.

Declaration
protected virtual TableDefinition CreateTableDefinition()
Returns
TableDefinition

The newly created TableDefinition.

InitializeSelection()

Initializes the selection.

Declaration
protected virtual void InitializeSelection()

OnCanUserSelectChanged(Boolean, Boolean)

Called when property CanUserSelect changes.

Declaration
protected virtual void OnCanUserSelectChanged(bool oldValue, bool newValue)
Parameters
System.Boolean oldValue

Old property value.

System.Boolean newValue

New property value.

OnCurrentItemChanged()

Called when the current item of the DataControl is changed.

Declaration
protected virtual void OnCurrentItemChanged()

OnItemsCollectionChanged(Object, NotifyCollectionChangedEventArgs)

Called when this.Items collection changes.

Declaration
protected virtual void OnItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
Parameters
System.Object sender

The sender.

System.Collections.Specialized.NotifyCollectionChangedEventArgs e

The System.Collections.Specialized.NotifyCollectionChangedEventArgs instance containing the event data.

OnItemsPropertyChanged(Object, PropertyChangedEventArgs)

Called when this.Items has a property changed.

Declaration
protected virtual void OnItemsPropertyChanged(object sender, PropertyChangedEventArgs e)
Parameters
System.Object sender

The sender.

System.ComponentModel.PropertyChangedEventArgs e

The System.ComponentModel.PropertyChangedEventArgs instance containing the event data.

OnItemsSourceChanged(Object, Object)

Called when ItemsSource property has changed.

Declaration
protected virtual void OnItemsSourceChanged(object oldValue, object newValue)
Parameters
System.Object oldValue

The old value.

System.Object newValue

The new value.

OnPropertyChanged(String)

Called when a property changes.

Declaration
protected virtual void OnPropertyChanged(string propertyName)
Parameters
System.String propertyName

Name of the property.

OnSelectedItemChanged(Object, Object)

Called when the selected item of the DataControl is changed.

Declaration
protected virtual void OnSelectedItemChanged(object oldItem, object newItem)
Parameters
System.Object oldItem

System.Object newItem

OnSelectionChanging(SelectionChangingEventArgs)

Raises the SelectionChangingEvent event.

Declaration
protected virtual void OnSelectionChanging(SelectionChangingEventArgs args)
Parameters
SelectionChangingEventArgs args

The SelectionChangingEventArgs instance containing the event data.

RaiseSelectionChangedEvent(SelectionChangeEventArgs)

Raises the selection changed event.

Declaration
protected virtual void RaiseSelectionChangedEvent(SelectionChangeEventArgs args)
Parameters
SelectionChangeEventArgs args

The SelectionChangeEventArgs instance containing the event data.

Rebind()

Rebinds the grid.

Declaration
public void Rebind()

SetIsCurrent(Object, Boolean)

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

Declaration
protected abstract void SetIsCurrent(object item, bool isCurrent)
Parameters
System.Object item

The data item.

System.Boolean isCurrent

If set to true container is current.

SetIsSelected(Object, Boolean)

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

Declaration
protected abstract void SetIsSelected(object item, bool isSelected)
Parameters
System.Object item

The data item.

System.Boolean isSelected

If set to true container is selected.

Events

PropertyChanged

Occurs when a property value changes.

Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
System.ComponentModel.PropertyChangedEventHandler

SelectionChanged

Occurs when the selected items have changed.

Declaration
public event EventHandler<SelectionChangeEventArgs> SelectionChanged
Event Type
System.EventHandler<SelectionChangeEventArgs>

SelectionChanging

Occurs when the selected items are about to change.

Declaration
public event EventHandler<SelectionChangingEventArgs> SelectionChanging
Event Type
System.EventHandler<SelectionChangingEventArgs>

Extension Methods

CollectionExtensions.ToEnumerable<T>(T)
EnumerableExtensions.ToEnumerable<T>(T)

Was this article helpful?

Tell us how we can improve this article

Skip
Getting Started
  • Install Now
  • Demos
  • SDK Samples Browser
  • Sample Applications
Support Resources
  • Code Library
  • Knowledge Base
  • MVVM Support
  • Videos
  • GitHub SDK Repository
Community
  • Forums
  • Blogs
  • XAML Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.