RadListViewElement
Represents the main element of RadListView.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class RadListViewElement : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider, IDataItemSource
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemUIItemBaseLightVisualElementRadListViewElement...
Derived Classes:
Implements:
Inherited Members
Constructors
public RadListViewElement()
Fields
protected object cachedOldValue
Properties
Gets the currently active editor when an edit operation is in progress.
[Browsable(false)]
public IInputEditor ActiveEditor { get; }
Returns null when no editing is taking place. The active editor provides access to the current edit value and allows for programmatic control over the editing process.
Gets or sets a value indicating whether items can have different heights from each other.
[Browsable(true)]
public bool AllowArbitraryItemHeight { get; set; }
When enabled, each item can be sized independently based on its content. When disabled, all items share the same height for consistent layout and improved performance.
Gets or sets a value indicating whether items can have different widths from each other.
[Browsable(true)]
public bool AllowArbitraryItemWidth { get; set; }
When enabled, each item can be sized independently based on its content width. When disabled, all items share the same width for consistent layout and improved performance.
Gets or sets a value indicating whether users can reorder columns by dragging and dropping them in Details View.
[Browsable(true)]
public bool AllowColumnReorder { get; set; }
When enabled, users can click and drag column headers to reposition them within the column layout. This provides a flexible way to customize the data presentation without requiring code changes.
Gets or sets a value indicating whether users can resize columns by dragging the column borders in Details View.
[Browsable(true)]
public bool AllowColumnResize { get; set; }
When enabled, users can position the mouse cursor over column borders and drag to adjust column widths. This provides interactive control over the data presentation layout.
Gets or sets a value indicating whether users can reorder items by dragging and dropping them within the list.
[Browsable(true)]
public bool AllowDragDrop { get; set; }
Item drag-and-drop is automatically disabled when using data sources, grouping, filtering, sorting, kinetic scrolling, or lasso selection, as these features conflict with manual item reordering.
Gets or sets a value indicating whether users can edit item values by activating edit mode.
[Browsable(true)]
public bool AllowEdit { get; set; }
When enabled, users can edit items by pressing F2, clicking on selected items, or programmatically calling edit methods. Editing behavior depends on the view type and current column in Details View.
Gets or sets a value indicating whether users can remove items by pressing the Delete key.
[Browsable(true)]
public bool AllowRemove { get; set; }
When enabled, pressing the Delete key will remove the selected items from the collection. The removal can be cancelled by handling the ItemRemoving event.
Gets or sets a value indicating how column widths are determined.
[Browsable(true)]
public ListViewAutoSizeColumnsMode AutoSizeColumnsMode { get; set; }
Different modes provide various automatic sizing behaviors such as fitting all columns within the available width, sizing based on content, or maintaining fixed widths. The sizing behavior is handled by the appropriate ColumnResizingBehavior implementation.
Gets or sets the BindingContext.
public override BindingContext BindingContext { get; set; }
Overrides:
Implements:
The binding context provides currency management and change tracking for data binding operations. When set, it triggers the BindingContextChanged event to notify of the change.
Gets or sets a value indicating whether column names which differ only in the casing are allowed.
[Browsable(true)]
public bool CaseSensitiveColumnNames { get; set; }
When set to true, columns with names like "Name" and "name" will be treated as different columns. This affects data binding operations, sorting, filtering, and grouping behavior.
Gets or sets the vertical alignment of checkboxes within list view items.
public CheckBoxesAlignment CheckBoxesAlignment { get; set; }
This property determines how checkboxes are aligned vertically within the bounds of each item, such as center, top, or bottom alignment.
Gets or sets the position of checkboxes relative to list view items.
public CheckBoxesPosition CheckBoxesPosition { get; set; }
Gets a collection containing all currently checked items when ShowCheckBoxes is enabled.
[Browsable(false)]
public ListViewCheckedItemCollection CheckedItems { get; }
Checked items are independent of selected items and allow for bulk operations on multiple items. The collection is read-only and automatically maintained as check states change.
Gets or sets the checked member.
[Browsable(true)]
public string CheckedMember { get; set; }
When data binding is used and ShowCheckBoxes is enabled, this property specifies which field or property from the data source should be used to determine whether each item's checkbox is checked. The field should contain boolean values.
Gets or sets the mode that determines when an item's check state changes in response to user clicks.
public CheckOnClickMode CheckOnClickMode { get; set; }
This property controls the relationship between item selection and checkbox state changes, allowing for different interaction patterns such as immediate toggling or requiring multiple clicks.
Gets or sets the ColumnResizingBehavior that is responsible for resizing the columns.
[Browsable(false)]
public BaseColumnResizingBehavior ColumnResizingBehavior { get; set; }
The column resizing behavior determines how columns respond to user resize operations and automatic sizing scenarios. Different behaviors can provide various resizing modes such as proportional resizing or fixed-width constraints.
Gets the collection of columns that define the structure and appearance of Details View.
[Browsable(true)]
public ListViewColumnCollection Columns { get; }
Each column represents a data field and defines how that field is displayed, including width, header text, and formatting. Columns are only used in Details View; other view types ignore this collection.
Gets or sets the currently active column in Details View for editing and navigation purposes.
[Browsable(false)]
public ListViewDetailColumn CurrentColumn { get; set; }
The current column determines which column will be edited when edit operations begin. Setting this property automatically ensures the column is visible and updates the column's current state.
Gets or sets the item that currently has focus and represents the navigation position within the list.
[Browsable(false)]
public ListViewDataItem CurrentItem { get; set; }
The current item is different from the selected item and represents the focused item for keyboard navigation. Setting this property updates the underlying data view's current position and ensures the item is visible.
Gets or sets the DataMember within the data source that the RadListViewElement should bind to.
public string DataMember { get; set; }
This property is used when the data source contains multiple tables or lists, such as a DataSet with multiple DataTables. It specifies which specific table or list should be used for data binding.
Gets or sets the data source of a RadListViewElement.
[Browsable(true)]
public object DataSource { get; set; }
The data source can be any object that implements IList, IListSource, or IEnumerable. When a data source is assigned, the list view automatically creates items and columns based on the data structure. Setting the data source to null clears the data binding and resets the DisplayMember, ValueMember, and CheckedMember properties.
Gets the DataView collection.
[Browsable(false)]
public RadCollectionView<ListViewDataItem> DataView { get; }
The data view wraps the underlying data source and provides a layer for data operations without modifying the original data. It supports complex filtering expressions, multi-level sorting, and hierarchical grouping.
Gets or sets the display member.
[Browsable(true)]
[TypeConverter("System.Windows.Forms.Design.DataMemberFieldConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string DisplayMember { get; set; }
When data binding is used, this property specifies which field or property from the data source should be displayed as the text content of each list item. If not specified, the ToString() method of the data objects is used.
Gets or sets the drag and drop service that handles item reordering and drag-drop operations.
public ListViewDragDropService DragDropService { get; set; }
The drag drop service provides functionality for dragging items within the list view and dropping them at different positions or to external targets.
Gets or sets a value indicating whether items should be automatically sorted when users click on column headers in Details View.
[Browsable(true)]
public bool EnableColumnSort { get; set; }
When enabled, clicking on column headers will cycle through ascending sort, descending sort, and no sort states. This provides an intuitive way for users to sort data without requiring custom code.
Gets or sets a value indicating whether custom grouping is enabled.
[Browsable(true)]
public bool EnableCustomGrouping { get; set; }
When enabled, grouping operations are handled through custom code rather than automatic grouping descriptors. This allows for complex grouping scenarios that cannot be expressed through simple property-based grouping.
Gets or sets a value indicating whether filtering is enabled.
[Browsable(true)]
public bool EnableFiltering { get; set; }
When enabled, items can be filtered programmatically using FilterDescriptors. Filtering allows hiding items that don't match specified criteria without removing them from the data source.
Gets or sets a value indicating whether grouping is enabled.
[Browsable(true)]
public bool EnableGrouping { get; set; }
When enabled, items can be grouped programmatically using GroupDescriptors. Grouping organizes items with similar values into collapsible categories for better data organization.
Gets or sets a value indicating whether kinetic scrolling is enabled, allowing smooth momentum-based scrolling with touch or mouse gestures.
[Browsable(true)]
public bool EnableKineticScrolling { get; set; }
Kinetic scrolling provides a natural scrolling experience with momentum and deceleration effects. This property always returns false when EnableLassoSelection is enabled, as the two features are incompatible.
Gets or sets a value indicating whether items can be selected with the mouse.
[Browsable(true)]
public bool EnableLassoSelection { get; set; }
When enabled, users can click and drag to create a selection rectangle that selects all items within its bounds. Lasso selection automatically disables kinetic scrolling and is not compatible with certain other features.
Gets or sets a value indicating whether sorting is enabled.
[Browsable(true)]
public bool EnableSorting { get; set; }
When enabled, items can be sorted programmatically using SortDescriptors. In design mode, this property maintains the design-time setting until runtime initialization.
Gets a collection of FilterDescriptor by which you can apply filter rules to the items.
[Browsable(true)]
public ListViewFilterDescriptorCollection FilterDescriptors { get; }
Filter descriptors allow creating complex filtering expressions that determine which items are visible in the list view. Filtering is only available when EnableFiltering is true.
Gets or sets a value indicating whether the entire row should be highlighted when an item is selected.
[Browsable(true)]
public bool FullRowSelect { get; set; }
When enabled, selection highlighting extends across the full width of the item area. When disabled, only the item content area is highlighted, which can provide a more compact appearance.
Gets a collection of GroupDescriptor which are used to define grouping rules over the ListViewDataItemCollection.
[Browsable(true)]
public GroupDescriptorCollection GroupDescriptors { get; }
Group descriptors specify the properties used for grouping items with similar values together. Multiple group descriptors create hierarchical grouping with nested group levels.
Gets or sets the indentation distance for items displayed within groups.
[Browsable(true)]
public int GroupIndent { get; set; }
When grouping is enabled, regular items are indented by this amount relative to group headers to provide visual hierarchy and distinction between groups and their contents.
Gets or sets the default group item size.
[Browsable(true)]
public Size GroupItemSize { get; set; }
This size applies to the visual elements that represent group headers when ShowGroups is enabled. A size of (0,0) indicates automatic sizing based on group header content.
Gets a collection containing the groups of the RadListViewElement.
[Browsable(true)]
public ListViewDataItemGroupCollection Groups { get; }
Groups are created automatically based on GroupDescriptors or can be manually managed when EnableCustomGrouping is enabled. Groups are only visible when ShowGroups is true.
Gets or sets the height of column headers in Details View.
[Browsable(true)]
public float HeaderHeight { get; set; }
This property controls the vertical space allocated for column headers when ShowColumnHeaders is enabled. The value is automatically scaled based on the current DPI settings for high-DPI scenarios.
Gets or sets the display state of the horizontal scrollbar.
[Browsable(true)]
public ScrollState HorizontalScrollState { get; set; }
Controls when the horizontal scrollbar appears: always visible, always hidden, or automatically shown only when the content width exceeds the available display area.
Gets or sets a value indicating whether items should react on mouse hover.
[Browsable(true)]
public bool HotTracking { get; set; }
When enabled, items will change their appearance (typically highlighting) when the mouse pointer moves over them, providing immediate visual feedback to users about which item they can interact with.
Gets a value indicating whether the control is currently bound to a data source.
[Browsable(false)]
public bool IsDataBound { get; }
Returns true when a data source has been assigned to the DataSource property. Data binding automatically creates items and columns based on the structure of the bound data.
Gets a value indicating whether an edit operation is currently active on an item.
[Browsable(false)]
public bool IsEditing { get; }
Returns true when an editor is active and the user is currently editing an item's value. This property is read-only and reflects the editing state managed by the ActiveEditor property.
Gets or sets a collection of ListViewDataItem object which represent the items in RadListViewElement.
[Browsable(true)]
public ListViewDataItemCollection Items { get; }
When data binding is used, this collection is automatically populated from the data source. When not data bound, items can be added and removed directly from this collection.
Gets or sets the default item size.
[Browsable(true)]
public Size ItemSize { get; set; }
This size is used as a starting point for item layout. Individual items may be sized differently if AllowArbitraryItemHeight or AllowArbitraryItemWidth are enabled. A size of (0,0) indicates automatic sizing based on content.
Gets or sets the spacing distance between adjacent items in the layout.
[Browsable(true)]
public int ItemSpacing { get; set; }
This property controls the gap between items, providing visual separation and improving readability. The spacing applies to both horizontal and vertical gaps depending on the current view type and layout direction.
Gets or sets a value indicating whether users can navigate to items by typing their first characters when the list view has focus.
public bool KeyboardSearchEnabled { get; set; }
When enabled, typing characters will search for and select the first item that starts with those characters. This provides quick keyboard navigation for large lists. The default value is false.
Gets or sets the time interval in milliseconds that must elapse before the keyboard search resets to start a new search.
public int KeyboardSearchResetInterval { get; set; }
After this interval without typing, the next keystroke will start a new search from the beginning rather than continuing the current search. The default value is 300 milliseconds.
Gets the list source that manages data binding operations and provides access to the underlying data.
[Browsable(false)]
public RadListSource<ListViewDataItem> ListSource { get; }
The list source acts as an intermediary between the list view and the data source, handling data binding, change notifications, and data transformation operations.
Gets or sets a value indicating whether multiple items can be selected simultaneously.
[Browsable(true)]
public bool MultiSelect { get; set; }
When enabled, users can select multiple items using Ctrl+Click, Shift+Click, or lasso selection. When disabled, selecting a new item automatically deselects any previously selected items.
Gets or sets the zero-based index of the currently selected item.
[Browsable(false)]
public int SelectedIndex { get; set; }
Returns -1 when no item is selected. Setting this property to a valid index selects the corresponding item, while setting it to an invalid index (negative or beyond the collection size) clears the selection.
Gets or sets the currently selected item in the list view.
[Browsable(false)]
public ListViewDataItem SelectedItem { get; set; }
Only one item can be selected at a time unless MultiSelect is enabled. Setting this property triggers selection change events and updates the visual appearance of items.
Gets a collection containing all currently selected items.
[Browsable(false)]
public ListViewSelectedItemCollection SelectedItems { get; }
When MultiSelect is disabled, this collection contains at most one item. The collection is read-only and automatically maintained as selection changes occur.
Gets or sets the border color of the lasso selection rectangle.
[Browsable(false)]
public Color SelectionRectangleBorderColor { get; set; }
This color defines the outline of the selection rectangle when EnableLassoSelection is enabled. The border provides clear visual feedback about the selection area boundaries.
Gets or sets the fill color of the lasso selection rectangle drawn during drag selection operations.
[Browsable(false)]
public Color SelectionRectangleColor { get; set; }
This color is used to fill the selection rectangle when EnableLassoSelection is enabled and users drag to select multiple items. The fill is typically semi-transparent to allow underlying content to show through.
Gets or sets a value indicating whether the last added item in the RadListView data source will be automatically selected by the control.
[Browsable(true)]
public bool SelectLastAddedItem { get; set; }
When set to true, adding new items to the data source will automatically select the most recently added item. This is useful for scenarios where immediate user attention should be drawn to newly created items.
Gets or sets a value indicating whether checkboxes should be displayed next to each item for selection purposes.
[Browsable(true)]
public bool ShowCheckBoxes { get; set; }
When enabled, each item displays a checkbox that can be checked independently of item selection. This allows for bulk operations on checked items and multi-state selection scenarios.
Gets or sets a value indicating whether column headers should be visible in Details View.
[Browsable(true)]
public bool ShowColumnHeaders { get; set; }
Column headers display column names and provide click targets for sorting operations. Hiding headers can save vertical space but removes sorting functionality and column identification.
Gets or sets a value indicating whether grid lines should be displayed in Details View to separate rows and columns.
[Browsable(true)]
public bool ShowGridLines { get; set; }
Grid lines provide visual separation between items and columns in Details View, making it easier to read tabular data. This property only affects Details View; other view types do not display grid lines.
Gets or sets a value indicating whether items should be organized and displayed in collapsible groups.
[Browsable(true)]
public bool ShowGroups { get; set; }
When enabled, items with the same group value are visually grouped together under expandable/collapsible group headers. Grouping works in conjunction with GroupDescriptors to define grouping criteria.
Gets a collection of SortDescriptor which are used to define sorting rules over the ListViewDataItemCollection.
[Browsable(true)]
public SortDescriptorCollection SortDescriptors { get; }
Sort descriptors specify the properties and directions used for sorting items. Multiple sort descriptors create multi-level sorting where items are sorted by the first descriptor, then by the second descriptor within equal groups, and so on.
Gets or sets a value indicating whether the checkboxes should be in ThreeState mode.
[Browsable(true)]
public bool ThreeStateMode { get; set; }
Gets or sets the value member.
[Browsable(true)]
public string ValueMember { get; set; }
When data binding is used, this property specifies which field or property from the data source should be used as the value for each list item. This is important for scenarios where the displayed text differs from the underlying value.
Gets or sets the display state of the vertical scrollbar.
[Browsable(true)]
public ScrollState VerticalScrollState { get; set; }
Controls when the vertical scrollbar appears: always visible, always hidden, or automatically shown only when the content height exceeds the available display area.
Gets the element that represents the active view.
[Browsable(false)]
public BaseListViewElement ViewElement { get; }
The view element is automatically created based on the view type and manages item layout, scrolling, virtualization, and user interaction for the specific view mode.
Gets or sets the visual layout mode that determines how items are presented and organized.
[Browsable(true)]
public virtual ListViewType ViewType { get; set; }
Changing the view type recreates the view element and can significantly alter the appearance and behavior of the list view. Available types include ListView (simple list), IconsView (icon grid), and DetailsView (table format).
Methods
Initiates an edit operation on the currently selected item.
public virtual bool BeginEdit()
True if the edit operation was successfully started; otherwise, false.
The edit operation will fail if editing is disabled, an editor is already active, multiple items are selected, no item is selected, or in Details View when no current column is set. The method ensures the item is visible and properly initializes the appropriate editor for the current view type.
Suspends item change notifications until EndUpdate() is called to improve performance.
public void BeginUpdate()
This method is useful when adding, removing, or modifying multiple items at once. It prevents individual change notifications from being fired for each operation, which can significantly improve performance during bulk operations.
Automatically adjusts column widths based on their content according to the specified fitting mode.
public void BestFitColumns(ListViewBestFitColumnMode mode)
The ListViewBestFitColumnMode that determines how columns should be sized.
This method only has an effect in Details View. It analyzes the content of columns and adjusts their widths to optimally display the data according to the specified mode, such as fitting headers, content, or both.
Completes the data binding process and raises the BindingCompleted event.
public void BindingComplete()
Implements:
This method is called when the data binding initialization process has finished successfully. It allows subscribers to perform any post-binding operations or UI updates.
Cancels the current edit operation, discarding any changes made to the item.
public bool CancelEdit()
True if the edit operation was successfully cancelled; otherwise, false.
This method abandons any changes made during the edit operation and restores the item to its previous state. The editor is properly cleaned up and removed from the visual tree.
Checks all of the items.
public void CheckAllItems()
This method is only effective when ShowCheckBoxes is enabled. It provides a convenient way to check all items in the list view regardless of their selection state.
Checks all of the selected items.
public void CheckSelectedItems()
This method is only effective when ShowCheckBoxes is enabled. It provides a convenient way to check all selected items in a single operation.
Collapses all group headers.
public void CollapseAll()
This method sets the Expanded property to false for all groups in the Groups collection. It only has an effect when ShowGroups is enabled and groups are present.
Creates a new binding context instance for managing data binding operations.
Creates and initializes all child elements and sets up the basic structure of the list view.
protected override void CreateChildElements()
Overrides:
This method creates the binding context, list source, data collections, view element, and other essential components. It also establishes event handlers and creates the initial view element based on the default view type.
Creates and returns the appropriate view element based on the current ViewType.
protected virtual BaseListViewElement CreateViewElement()
A new BaseListViewElement instance configured for the current view type.
This method acts as a factory for creating view-specific elements. It creates different element types for ListView, IconsView, and DetailsView, with ListView as the default fallback option.
Disposes of managed resources including cached editors and the list source.
protected override void DisposeManagedResources()
Overrides:
This method performs cleanup of managed resources, including unwiring events, disposing cached editors and their elements, clearing the editor cache, and disposing the list source. It ensures proper resource cleanup to prevent memory leaks.
Ends the current edit operation, saving any changes made to the item.
public bool EndEdit()
True if the edit operation was successfully completed; otherwise, false.
This method commits any changes made during the edit operation and properly cleans up the editor. If validation fails or other issues occur, the edit operation may not complete successfully.
Implements the core logic for ending or cancelling an edit operation.
protected virtual bool EndEditCore(bool commitChanges)
True to save changes; false to discard them.
Returns:True if the operation completed successfully; otherwise, false.
This method handles the complete lifecycle of ending an edit operation, including validation, value saving, editor cleanup, and event notification. It includes protection against re-entrant calls and ensures proper state management.
Resumes item change notifications that were suspended by BeginUpdate().
public void EndUpdate()
This method restores normal change notification behavior and triggers any pending notifications that were accumulated during the update suspension period.
Scrolls the view to ensure that the specified column is visible in Details View.
public virtual void EnsureColumnVisible(ListViewDetailColumn listViewDetailColumn)
The ListViewDetailColumn to make visible.
This method only has an effect when the current view type is Details View. It scrolls horizontally to bring the specified column into the visible area of the control.
Scrolls the view to ensure that the specified item is visible, with optional horizontal scrolling.
public virtual void EnsureItemVisible(ListViewDataItem item, bool ensureHorizontally)
The ListViewDataItem to make visible.
ensureHorizontallyboolIf true, also scrolls horizontally to ensure the item is fully visible.
This method provides more control over the scrolling behavior by allowing horizontal scrolling in addition to vertical scrolling. This is particularly useful in scenarios where items may extend beyond the horizontal bounds of the view.
Scrolls the view to ensure that the specified item is visible within the client area.
public virtual void EnsureItemVisible(ListViewDataItem item)
The ListViewDataItem to make visible.
This method scrolls the list view vertically to bring the specified item into view. If the item is already visible, no scrolling occurs.
Expands all group headers.
public void ExpandAll()
This method sets the Expanded property to true for all groups in the Groups collection. It only has an effect when ShowGroups is enabled and groups are present.
Searches for and returns the first item that has the specified key value, with an option to search only visible items.
public virtual ListViewDataItem FindItemByKey(object key, bool searchVisibleItems)
The key value to search for.
searchVisibleItemsboolIf true, searches only currently visible items; if false, searches all items.
Returns:The first ListViewDataItem with the specified key, or null if no match is found.
When searchVisibleItems is true, only items that are currently virtualized and visible
in the view will be searched. This can be more efficient for large datasets but may not find items
that are scrolled out of view.
Searches for and returns the first item that has the specified key value.
public virtual ListViewDataItem FindItemByKey(object key)
The key value to search for.
Returns:The first ListViewDataItem with the specified key, or null if no match is found.
This method searches through all items in the collection, including items that may not currently be visible. The search uses object equality comparison to match the key values.
Retrieves or creates an editor instance of the specified type from the editor cache.
protected virtual IInputEditor GetEditor(Type editorType)
The type of editor to retrieve or create.
Returns:An instance of the specified editor type, or null if creation fails.
This method maintains a cache of editor instances to improve performance by reusing editors across multiple edit operations. If an editor of the requested type doesn't exist in the cache, a new instance is created and added to the cache.
Initializes the RadListViewElement.
public void Initialize()
Implements:
This method performs a complete reset of the list view's data-related state, including clearing visual items, resetting selections, and rebuilding bound columns if data binding is active. The operation is performed with layout suspension for optimal performance.
Initializes the editor for the specified visual item with the appropriate initial value.
protected virtual void InitializeEditor(BaseListViewVisualItem visualItem, ISupportInitialize initializable, IInputEditor editor)
The visual item being edited.
initializableISupportInitializeThe initializable interface of the editor, if supported.
editorIInputEditorThe editor instance to initialize.
This method sets up the editor with the correct initial value based on the current view type. In Details View, the value comes from the current column; otherwise, it uses the item's main value. The method also handles Material theme adjustments for proper editor display.
Measures the desired size of the element within the constraints of the available size.
protected override SizeF MeasureOverride(SizeF availableSize)
The available space that can be given to the element.
Returns:The desired size of the element.
Overrides:
This method ensures that infinite sizes are converted to the measured size to prevent layout issues. It provides a consistent measurement result that works within the layout system constraints.
Creates a new item for the data source.
public IDataItem NewItem()
A new ListViewDataItem instance configured for this list view element.
Implements:
This method creates a new item and allows for customization through the ItemCreating event. The created item is automatically assigned ownership to this list view element.
Raises the BindingContextChanged event when the binding context changes.
Raises the CellCreating event when a cell element needs to be created.
protected virtual void OnCellCreating(ListViewCellElementCreatingEventArgs args)
The event data containing the cell creation information.
Raises the CellFormatting event when a cell in Details View needs formatting.
protected virtual void OnCellFormatting(ListViewCellFormattingEventArgs args)
The event data containing the cell formatting information.
Raises the ColumnCreating event when a column needs to be created.
protected virtual void OnColumnCreating(ListViewColumnCreatingEventArgs args)
The event data containing the column creation information.
Raises the CurrentItemChanged event when the current item has changed.
protected virtual void OnCurrentItemChanged(ListViewItemEventArgs args)
The event data containing the current item information.
Raises the CurrentItemChanging event and allows cancellation of the current item change.
protected virtual bool OnCurrentItemChanging(ListViewItemChangingEventArgs args)
The event data containing the current item change information.
Returns:Returns true if the operation was cancelled; otherwise, false.
Raises the ItemCreating event when a data item needs to be created.
protected virtual void OnDataItemCreating(ListViewItemCreatingEventArgs args)
The event data containing the item creation information.
Raises the ItemEdited event when an item has been edited.
protected virtual void OnEdited(ListViewItemEditedEventArgs args)
The event data containing the editing information.
Raises the ItemEditing event when an edit operation is about to begin.
protected virtual void OnEditing(ListViewItemEditingEventArgs e)
The event data containing the editing information.
Raises the EditorInitialized event when an editor has been successfully initialized.
protected virtual void OnEditorInitialized(ListViewItemEditorInitializedEventArgs e)
The event data containing the editor initialization information.
Raises the EditorRequired event when an editor is needed for item editing.
protected virtual void OnEditorRequired(ListViewItemEditorRequiredEventArgs e)
The event data containing the editor requirements.
Raises the ItemCheckedChanged event when an item's check state has changed.
protected virtual void OnItemCheckedChanged(ListViewItemEventArgs args)
The event data containing the item information.
Raises the ItemCheckedChanging event and allows cancellation of the item check state change.
protected virtual bool OnItemCheckedChanging(ListViewItemCancelEventArgs args)
The event data containing the item check state change information.
Returns:Returns true if the operation was cancelled; otherwise, false.
Raises the ItemDataBound event when an item is bound to data.
protected virtual void OnItemDataBound(ListViewDataItem item)
The ListViewDataItem that was bound to data.
Raises the ItemMouseClick event when an item is clicked.
protected virtual void OnItemMouseClick(ListViewItemEventArgs args)
The event data containing the item information.
Raises the ItemMouseDoubleClick event when an item is double-clicked.
protected virtual void OnItemMouseDoubleClick(ListViewItemEventArgs args)
The event data containing the item information.
Raises the ItemMouseDown event when a mouse button is pressed over an item.
protected virtual void OnItemMouseDown(ListViewItemMouseEventArgs args)
The event data containing the item and mouse information.
Raises the ItemMouseEnter event when the mouse pointer enters an item.
protected virtual void OnItemMouseEnter(ListViewItemEventArgs args)
The event data containing the item information.
Raises the ItemMouseHover event when the mouse pointer hovers over an item.
protected virtual void OnItemMouseHover(ListViewItemEventArgs args)
The event data containing the item information.
Raises the ItemMouseLeave event when the mouse pointer leaves an item.
protected virtual void OnItemMouseLeave(ListViewItemEventArgs args)
The event data containing the item information.
Raises the ItemMouseMove event when the mouse pointer moves over an item.
protected virtual void OnItemMouseMove(ListViewItemMouseEventArgs args)
The event data containing the item and mouse information.
Raises the ItemMouseUp event when a mouse button is released over an item.
protected virtual void OnItemMouseUp(ListViewItemMouseEventArgs args)
The event data containing the item and mouse information.
Raises the ItemRemoved event when an item has been removed.
protected virtual void OnItemRemoved(ListViewItemEventArgs args)
The event data containing the removed item information.
Raises the ItemRemoving event and allows cancellation of the item removal.
protected virtual bool OnItemRemoving(ListViewItemCancelEventArgs args)
The event data containing the item removal information.
Returns:Returns true if the operation was cancelled; otherwise, false.
Raises the SelectedIndexChanged event when the selected item index changes.
protected virtual void OnSelectedIndexChanged()
Raises the SelectedItemChanged event when the selected item changes.
protected virtual void OnSelectedItemChanged(ListViewDataItem item)
The newly selected ListViewDataItem.
Raises the SelectedItemChanging event and allows cancellation of the item selection.
protected virtual bool OnSelectedItemChanging(ListViewItemCancelEventArgs args)
The event data containing the item selection information.
Returns:Returns true if the operation was cancelled; otherwise, false.
Raises the SelectedItemsChanged event when the selected items collection changes.
protected virtual void OnSelectedItemsChanged()
protected override void OnStyleChanged(RadPropertyChangedEventArgs e)
Overrides:
Raises the ValidationError event when a validation error occurs.
protected virtual void OnValidationError(EventArgs args)
The event data for the validation error.
Raises the ItemValueChanged event when an item's value has changed.
protected virtual void OnValueChanged(ListViewItemValueChangedEventArgs args)
The event data containing the value change information.
Raises the ItemValueChanging event and allows cancellation of the value change.
protected virtual bool OnValueChanging(ListViewItemValueChangingEventArgs args)
The event data containing the value change information.
Returns:Returns true if the operation was cancelled; otherwise, false.
Raises the ItemValidating event when an item value needs to be validated.
protected virtual void OnValueValidating(ListViewItemValidatingEventArgs args)
The event data containing the validation information.
Raises the ViewTypeChanged event when the view type has changed.
protected virtual void OnViewTypeChanged()
Raises the ViewTypeChanging event and allows cancellation of the view type change.
protected virtual bool OnViewTypeChanging(ViewTypeChangingEventArgs args)
The event data containing the view type change information.
Returns:Returns true if the operation was cancelled; otherwise, false.
Raises the VisualItemCreating event when a visual item needs to be created.
protected virtual void OnVisualItemCreating(ListViewVisualItemCreatingEventArgs args)
The event data containing the visual item creation information.
Raises the VisualItemFormatting event when a visual item needs formatting.
protected virtual void OnVisualItemFormatting(BaseListViewVisualItem item)
The BaseListViewVisualItem that needs formatting.
Processes key down events for keyboard navigation and interaction within the list view.
public virtual bool ProcessKeyDown(KeyEventArgs e)
The key event data containing information about the key pressed and modifier keys.
Returns:True if the event was handled by the list view; otherwise, false.
Processes key press events for character input and keyboard search functionality.
public virtual bool ProcessKeyPress(KeyPressEventArgs e)
The key press event data containing information about the character typed.
Returns:True if the event was handled by the list view; otherwise, false.
Processes mouse down events when a mouse button is pressed over the list view.
public virtual bool ProcessMouseDown(MouseEventArgs e)
The mouse event data containing information about the button pressed and cursor position.
Returns:True if the event was handled by the list view; otherwise, false.
Processes mouse move events when the mouse pointer moves over the list view.
public virtual bool ProcessMouseMove(MouseEventArgs e)
The mouse event data containing information about the cursor position and movement.
Returns:True if the event was handled by the list view; otherwise, false.
Processes mouse up events when the mouse button is released over the list view.
public virtual bool ProcessMouseUp(MouseEventArgs e)
The mouse event data containing information about the button released and cursor position.
Returns:True if the event was handled by the list view; otherwise, false.
Processes mouse wheel events for scrolling the list view content.
public virtual bool ProcessMouseWheel(MouseEventArgs e)
The mouse event data containing information about the wheel movement and direction.
Returns:True if the event was handled by the list view; otherwise, false.
Resets the current item to null and clears the current state from the previously current item.
public void ResetCurrentItem()
This method is used internally to clear the current item state without triggering change events. It ensures proper cleanup of the current item's visual state.
Saves the edited value to the appropriate item property with validation.
protected virtual void SaveEditorValue(BaseListViewVisualItem visualItem, object newValue)
The visual item that was edited.
newValueobjectThe new value from the editor.
This method performs validation of the new value and converts empty strings to null. If validation fails, a validation error event is raised and the value is not saved. The method handles the different save paths for Details View and other view types.
Scrolls the view by the specified amount in pixels.
public void ScrollTo(int delta)
The amount to scroll in pixels. Positive values scroll down, negative values scroll up.
Selects the specified array of items in the list view.
public void Select(ListViewDataItem[] items)
An array of ListViewDataItem objects to select.
If MultiSelect is disabled, only the last item in the array will be selected. If MultiSelect is enabled, all items in the array will be selected. The method automatically handles the selection state management and event notifications.
Sets the value on the selected item, handling the differences between view types.
protected virtual void SetSelectedItemValue(ListViewItemValueChangingEventArgs valueChangingArgs, object newValue)
The event arguments for the value change operation.
newValueobjectThe new value to set on the item.
In Details View, the value is set on the specific column of the item. In other view types, the value is set on the item's main Value property. The method ensures that appropriate change events are raised during the operation.
Synchronizes the visual representation of items with their underlying data state.
public virtual void SynchronizeVisualItems()
This method ensures that all visual items reflect the current state of their corresponding data items. It iterates through all visual children and calls their Synchronize method to update their appearance based on current data, selection state, and other properties.
Unchecks all of the items.
public void UncheckAllItems()
This method is only effective when ShowCheckBoxes is enabled. It provides a convenient way to uncheck all items in the list view regardless of their selection state.
Unchecks all of the selected items.
public void UncheckSelectedItems()
This method is only effective when ShowCheckBoxes is enabled. It provides a convenient way to uncheck all selected items in a single operation.
Unsubscribes from all collection and view events to prevent memory leaks during disposal.
protected virtual void UnwireEvents()
This method removes all event handlers that were established in WireEvents() to ensure proper cleanup and prevent potential memory leaks when the element is being disposed.
Triggers various update operations on the list view based on the specified update mode flags.
public virtual void Update(RadListViewElement.UpdateModes updateMode)
A combination of RadListViewElement.UpdateModes flags indicating which operations to perform.
This method allows fine-grained control over what aspects of the list view should be updated. Multiple update modes can be combined using bitwise OR operations to perform multiple updates in a single call for optimal performance.
Updates the contents of the CheckedItems collection.
public void UpdateCheckedItems()
This method rebuilds the checked items collection by examining the check state of every item in the list view. It should be called when the check states may have been modified outside of the normal checkbox interaction mechanisms.
Subscribes to the necessary collection and view events for proper data synchronization.
protected virtual void WireEvents()
This method establishes event handlers for groups, columns, filter descriptors, sort descriptors, and collection view changes. These handlers ensure that the UI stays synchronized with data changes.
Events
Occurs when the data binding process for the RadListViewElement has completed successfully.
public event EventHandler BindingCompleted
Occurs when the BindingContext property value changes.
public event EventHandler BindingContextChanged
Implements:
Occurs when a DetailListViewCellElement needs to be created for Details View.
public event ListViewCellElementCreatingEventHandler CellCreating
Occurs when a cell in Details View needs to be formatted.
public event ListViewCellFormattingEventHandler CellFormatting
Occurs when a ListViewDetailColumn needs to be created during data binding.
public event ListViewColumnCreatingEventHandler ColumnCreating
Occurs when the CurrentItem property has changed.
public event ListViewItemEventHandler CurrentItemChanged
Occurs when the CurrentItem property is about to change and allows cancellation of the operation.
public event ListViewItemChangingEventHandler CurrentItemChanging
Occurs when an editor has been initialized for editing an item.
public event ListViewItemEditorInitializedEventHandler EditorInitialized
Occurs when an editor is required for editing a list view item.
public event ListViewItemEditorRequiredEventHandler EditorRequired
Occurs when a group has been expanded in the list view.
public event EventHandler<ListViewGroupEventArgs> GroupExpanded
Occurs when a group is about to expand and allows cancellation of the operation.
public event EventHandler<ListViewGroupCancelEventArgs> GroupExpanding
Occurs when the checked state of a ListViewDataItem has changed.
public event ListViewItemEventHandler ItemCheckedChanged
Occurs when a ListViewDataItem is about to be checked and allows cancellation of the operation.
public event ListViewItemCancelEventHandler ItemCheckedChanging
Occurs when a ListViewDataItem needs to be created during data binding or item creation.
public event ListViewItemCreatingEventHandler ItemCreating
Occurs when a data-bound item is being attached to a ListViewDataItem.
public event ListViewItemEventHandler ItemDataBound
Occurs when a ListViewDataItem has been edited and the edit operation is complete.
public event ListViewItemEditedEventHandler ItemEdited
Occurs when an edit operation is about to begin and allows cancellation of the operation.
public event ListViewItemEditingEventHandler ItemEditing
Occurs when the user clicks a ListViewDataItem.
public event ListViewItemEventHandler ItemMouseClick
Occurs when the user double-clicks a ListViewDataItem.
public event ListViewItemEventHandler ItemMouseDoubleClick
Occurs when the user presses a mouse button over a ListViewDataItem.
public event ListViewItemMouseEventHandler ItemMouseDown
Occurs when the mouse pointer enters the bounds of a ListViewDataItem.
public event ListViewItemEventHandler ItemMouseEnter
Occurs when the user hovers the mouse pointer over a ListViewDataItem.
public event ListViewItemEventHandler ItemMouseHover
Occurs when the mouse pointer leaves the bounds of a ListViewDataItem.
public event ListViewItemEventHandler ItemMouseLeave
Occurs when the user moves the mouse pointer over a ListViewDataItem.
public event ListViewItemMouseEventHandler ItemMouseMove
Occurs when the user releases a mouse button over a ListViewDataItem.
public event ListViewItemMouseEventHandler ItemMouseUp
Occurs when an item has been removed using the Delete key.
public event ListViewItemEventHandler ItemRemoved
Occurs when an item is about to be removed using the Delete key and allows cancellation of the operation.
public event ListViewItemCancelEventHandler ItemRemoving
Occurs when an edit operation needs to be validated before the changes are committed.
public event ListViewItemValidatingEventHandler ItemValidating
Occurs when the value of a ListViewDataItem has changed.
public event ListViewItemValueChangedEventHandler ItemValueChanged
Occurs when the value of a ListViewDataItem is about to change and allows cancellation of the operation.
public event ListViewItemValueChangingEventHandler ItemValueChanging
Occurs when the index of the selected item has changed.
public event EventHandler SelectedIndexChanged
Occurs when the selected item has changed in the list view.
public event EventHandler SelectedItemChanged
Occurs when a ListViewDataItem is about to be selected and allows cancellation of the operation.
public event ListViewItemCancelEventHandler SelectedItemChanging
Occurs when the content of the SelectedItems collection has changed.
public event EventHandler SelectedItemsChanged
Occurs when a validation error occurs during item editing.
public event EventHandler ValidationError
Occurs when the ViewType of the RadListView has changed.
public event EventHandler ViewTypeChanged
Occurs when the ViewType of the RadListView is about to change and allows cancellation of the operation.
public event ViewTypeChangingEventHandler ViewTypeChanging
Occurs when a BaseListViewVisualItem needs to be created for visual representation.
public event ListViewVisualItemCreatingEventHandler VisualItemCreating
Occurs when a ListViewDataItem changes its state and needs to be formatted.
public event ListViewVisualItemEventHandler VisualItemFormatting