Class CheckListBox
Represents a control that displays the multiple items with the System.Windows.Controls.CheckBox.
Inheritance
Implements
Namespace: Syncfusion.Windows.Tools.Controls
Assembly: Syncfusion.Tools.Wpf.dll
Syntax
[SkinType]
[SkinType]
[SkinType]
[SkinType]
[SkinType]
[SkinType]
[SkinType]
[SkinType]
[SkinType]
[SkinType]
[SkinType]
[SkinType]
[SkinType]
[SkinType]
[SkinType]
public class CheckListBox : ItemsControl, IDisposable
Remarks
The CheckListBox provides a flexible way to select multiple items by loading a items with the System.Windows.Controls.CheckBox.
Examples
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Syncfusion.Windows.Tools.Controls;
namespace checklistbox
{
///
/// Interaction logic for Window1.xaml
///
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
CheckListBox checklistbox = new CheckListBox();
this.Content = checklistbox;
}
}
}
Constructors
CheckListBox()
Initializes a new instance of the CheckListBox class.
Declaration
public CheckListBox()
Remarks
The CheckListBox displays items with a checkbox to enable multiple selection of items.
Fields
CheckBoxAlignmentProperty
Identifies the CheckBoxAlignment dependency property.
Declaration
public static readonly DependencyProperty CheckBoxAlignmentProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the CheckBoxAlignment dependency property.
DragEndEvent
Occurs when the CheckListBox items dragged to drop into the other CheckListBox.
Declaration
public static readonly RoutedEvent DragEndEvent
Field Value
Type |
---|
System.Windows.RoutedEvent |
Remarks
This event is raised if the items dragging is ended.
DragStartEvent
Occurs when the CheckListBox items started dragging to drop into the other CheckListBox.
Declaration
public static readonly RoutedEvent DragStartEvent
Field Value
Type |
---|
System.Windows.RoutedEvent |
Remarks
This event is raised if the items dragging is started.
GroupDescriptionsProperty
Identifies the GroupDescriptions dependency property.
Declaration
public static readonly DependencyProperty GroupDescriptionsProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the GroupDescriptions dependency property.
GroupTemplateProperty
Identifies the GroupTemplate dependency property.
Declaration
public static readonly DependencyProperty GroupTemplateProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the GroupTemplate dependency property.
IsCheckedMemberPathProperty
Identifies the IsCheckedMemberPath dependency property.
Declaration
public static readonly DependencyProperty IsCheckedMemberPathProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
Identifies the IsCheckedMemberPath dependency property.
IsCheckOnFirstClickProperty
Identifies the IsCheckOnFirstClick dependency property.
Declaration
public static readonly DependencyProperty IsCheckOnFirstClickProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the IsCheckOnFirstClick dependency property.
IsDragDropEnabledProperty
Identifies the IsDragDropEnabled dependency property.
Declaration
public static readonly DependencyProperty IsDragDropEnabledProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the IsDragDropEnabled dependency property.
IsSelectAllEnabledProperty
Identifies the IsSelectAllEnabled dependency property.
Declaration
public static readonly DependencyProperty IsSelectAllEnabledProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the IsSelectAllEnabled dependency property.
MouseOverBackgroundProperty
Identifies the MouseOverBackground dependency property.
Declaration
public static readonly DependencyProperty MouseOverBackgroundProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the MouseOverBackground dependency property.
SelectAllTemplateProperty
Identifies the SelectAllTemplate dependency property.
Declaration
public static readonly DependencyProperty SelectAllTemplateProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the SelectAllTemplate dependency property.
SelectedItemBackgroundProperty
Identifies the SelectedItemBackground dependency property.
Declaration
public static readonly DependencyProperty SelectedItemBackgroundProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the SelectedItemBackground dependency property.
SelectedItemProperty
Identifies the SelectedItem dependency property.
Declaration
public static readonly DependencyProperty SelectedItemProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the SelectedItem dependency property.
SelectedItemsProperty
Identifies the SelectedItems dependency property.
Declaration
public static readonly DependencyProperty SelectedItemsProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the SelectedItems dependency property.
SelectedValuePathProperty
Identifies the SelectedValuePath dependency property.
Declaration
public static readonly DependencyProperty SelectedValuePathProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the SelectedValuePath dependency property.
SelectedValueProperty
Identifies the SelectedValue dependency property.
Declaration
public static readonly DependencyProperty SelectedValueProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the SelectedValue dependency property.
SortDescriptionsProperty
Identifies the SortDescriptions dependency property.
Declaration
public static readonly DependencyProperty SortDescriptionsProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Remarks
The identifier for the SortDescriptions dependency property.
Properties
GroupDescriptions
Gets or sets the collection of grouping descriptions of the group items in the CheckListBox.
Declaration
public ObservableCollection<GroupDescription> GroupDescriptions { get; set; }
Property Value
Type |
---|
System.Collections.ObjectModel.ObservableCollection<System.ComponentModel.GroupDescription> |
Remarks
The GroupDescriptions contains the group items descriptions.
GroupTemplate
Gets or sets System.Windows.DataTemplate that defines the visual representation of the group header items in the CheckListBox.
Declaration
public DataTemplate GroupTemplate { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.DataTemplate | The object that defines the visual representation of the group header. |
IsCheckedMemberPath
Gets or sets the name of the property that is bound to the IsChecked property of CheckListBoxItem.
Declaration
public string IsCheckedMemberPath { get; set; }
Property Value
Type |
---|
System.String |
Remarks
The IsCheckedMemberPath property is used to bind the specified boolean property in the data source, identified by its name, to the IsChecked property of the CheckedListBoxItem. This allows synchronization of changes in the IsChecked property of the CheckedListBoxItem with the associated bound property. The value stored in this property should be the name of a boolean property in the data source to which the CheckedListBoxItem is bound. The binding will not function if this property is empty or null. For example, if you have a collection of items with a "IsSelected" boolean property, you can set IsCheckedMemberPath to "IsSelected" to bind the IsChecked property of the CheckedListBoxItem to the "IsSelected" property in the data source. Any changes made to the IsChecked property will be reflected in the "IsSelected" property, and vice versa.
IsCheckOnFirstClick
Gets or sets a value that indicates whether the CheckListBoxItem is check on first click.
Declaration
public bool IsCheckOnFirstClick { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the check on first click is enabled for CheckListBoxItem; otherwise, false.The default value is true. |
IsDragDropEnabled
Gets or sets a value that indicates whether the drag drop is enabled for the CheckListBoxItem.
Declaration
public bool IsDragDropEnabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if drag drop is enabled for the CheckListBoxItem; otherwise, false.The default value is false. |
IsSelectAllEnabled
Gets or sets a value that indicates whether the "SelectAll" item is shown.
Declaration
public bool IsSelectAllEnabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the "SelectAll" item is enabled; otherwise, false.The default value is true. |
MouseOverBackground
Gets or sets a brush that describes the mouse hover background of a selected CheckListBoxItem.
Declaration
public Brush MouseOverBackground { get; set; }
Property Value
Type |
---|
System.Windows.Media.Brush |
SelectAllTemplate
Gets or sets System.Windows.DataTemplate that defines the visual representation of the "SelectAll" item in the CheckListBox.
Declaration
public DataTemplate SelectAllTemplate { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.DataTemplate | The object that defines the visual representation of the "SelectAll" item. |
SelectedItem
Gets or sets the currently selected item or returns null if the selection is empty in the CheckListBox.
Declaration
public object SelectedItem { get; set; }
Property Value
Type | Description |
---|---|
System.Object | An object that represents the current selection in the control. |
Remarks
The item which is selected or null if the selection is empty.
SelectedItemBackground
Gets or sets a brush that describes the background of a selected CheckListBoxItem.
Declaration
public Brush SelectedItemBackground { get; set; }
Property Value
Type |
---|
System.Windows.Media.Brush |
SelectedItems
Gets or sets a collection containing the currently checked items in the CheckListBox.
Declaration
public ObservableCollection<object> SelectedItems { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ObservableCollection<System.Object> | A Observable ObjectCollection containing the currently checked items in the control. |
Remarks
The collection of items in the CheckListBox that are checked.
SelectedValue
Gets or sets the value of the SelectedItem in the CheckListBox control.
Declaration
public object SelectedValue { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The value of the selected item in the CheckListBox control. The default value is an empty string (""). |
Remarks
The SelectedValue is sets to null when the SelectedItem is "SelectAll" or SelectedValuePath property is null.
SelectedValuePath
Gets or sets the path that is used to get the SelectedValue from the SelectedItem.
Declaration
public string SelectedValuePath { get; set; }
Property Value
Type | Description |
---|---|
System.String | The path used to get the SelectedValue. The default is an empty string. |
Remarks
The SelectedValuePath property specifies the path to the property that is used to determine the value of the SelectedValue property.
SortDescriptions
Gets or sets the the sorting order descriptions of group items in the CheckListBox.
Declaration
public SortDescriptionCollection SortDescriptions { get; set; }
Property Value
Type |
---|
System.ComponentModel.SortDescriptionCollection |
Remarks
The SortDescriptions contains the sorting order descriptions of the group items.
Methods
add_DragEnd(CheckListBox.DragCheckListBoxHandler)
Declaration
public void add_DragEnd(CheckListBox.DragCheckListBoxHandler value)
Parameters
Type | Name | Description |
---|---|---|
CheckListBox.DragCheckListBoxHandler | value |
add_DragStart(CheckListBox.DragCheckListBoxHandler)
Declaration
public void add_DragStart(CheckListBox.DragCheckListBoxHandler value)
Parameters
Type | Name | Description |
---|---|---|
CheckListBox.DragCheckListBoxHandler | value |
CanStartDrag(Point, Point)
Determines whether this instance [can start drag] the specified starting mouse offset.
Declaration
public static bool CanStartDrag(Point startingMouseOffset, Point currentMouseOffset)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Point | startingMouseOffset | The starting mouse offset. |
System.Windows.Point | currentMouseOffset | The current mouse offset. |
Returns
Type | Description |
---|---|
System.Boolean | true if this instance [can start drag] the specified starting mouse offset; otherwise, false. |
Dispose()
Release the unmanaged resources of CheckListBox.
Declaration
public void Dispose()
FindAncestor(Type, Visual)
Finds the ancestor of the items.
Declaration
public static FrameworkElement FindAncestor(Type ancestorType, Visual visual)
Parameters
Type | Name | Description |
---|---|---|
System.Type | ancestorType | The type of ancestor to find. |
System.Windows.Media.Visual | visual | The visual of the ancestor. |
Returns
Type | Description |
---|---|
System.Windows.FrameworkElement | It returns the System.Windows.FrameworkElement. |
GetCheckBoxAlignment(DependencyObject)
Specifies the alignment of the System.Windows.Controls.CheckBox.
Declaration
public static CheckBoxAlignment GetCheckBoxAlignment(DependencyObject obj)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | obj | The obj contains the System.Windows.DependencyObject. |
Returns
Type | Description |
---|---|
CheckBoxAlignment | It returns the CheckBoxAlignment. |
GetCheckBoxFromChildren(FrameworkElement)
Specifies the System.Windows.Controls.CheckBox from the given framework element.
Declaration
public static CheckBox GetCheckBoxFromChildren(FrameworkElement element)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.FrameworkElement | element | The System.Windows.FrameworkElement that contains System.Windows.Controls.CheckBox framework |
Returns
Type | Description |
---|---|
System.Windows.Controls.CheckBox | This methods returns the System.Windows.Controls.CheckBox. |
GetCheckListBoxItemFromChildren(FrameworkElement)
Specifies the CheckListBoxItem from the given framework element.
Declaration
public static CheckListBoxItem GetCheckListBoxItemFromChildren(FrameworkElement element)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.FrameworkElement | element | The System.Windows.FrameworkElement that contains CheckListBoxItem framework |
Returns
Type | Description |
---|---|
CheckListBoxItem | This methods returns the CheckListBoxItem. |
OnApplyTemplate()
Invoked before the UI element displays in an application and when a new template is applied.
Declaration
public override void OnApplyTemplate()
OnDragOver(DragEventArgs)
Invoked when an unhandled System.Windows.DragDrop.DragOver attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
Declaration
protected override void OnDragOver(DragEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DragEventArgs | e | The System.Windows.DragEventArgs that contains the event data. |
OnDrop(DragEventArgs)
Invoked when an unhandled System.Windows.DragDrop.DragEnter attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
Declaration
protected override void OnDrop(DragEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DragEventArgs | e | The System.Windows.DragEventArgs that contains the event data. |
OnIsDragDropEnabled(DependencyPropertyChangedEventArgs)
Raises the IsDragDropEnabledChanged event.
Declaration
protected virtual void OnIsDragDropEnabled(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | The System.Windows.DependencyPropertyChangedEventArgs that contains the event data. |
OnItemsSourceChanged(IEnumerable, IEnumerable)
Called when System.Windows.Controls.ItemsControl.ItemsSource property changes.
Declaration
protected override void OnItemsSourceChanged(IEnumerable oldValue, IEnumerable newValue)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | oldValue | The Old value of the System.Windows.Controls.ItemsControl.ItemsSource property. |
System.Collections.IEnumerable | newValue | The New value of the System.Windows.Controls.ItemsControl.ItemsSource property. |
OnKeyDown(KeyEventArgs)
Invoked when the System.Windows.UIElement.KeyDown event is received.
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.KeyEventArgs | e | The System.Windows.Input.KeyEventArgs that contains the event data. |
OnPreviewDragLeave(DragEventArgs)
Invoked when an unhandled System.Windows.DragDrop.PreviewDragLeave attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
Declaration
protected override void OnPreviewDragLeave(DragEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DragEventArgs | e | The System.Windows.DragEventArgs that contains the event data. |
OnPreviewMouseLeftButtonDown(MouseButtonEventArgs)
Invoked when an unhandled System.Windows.UIElement.PreviewMouseLeftButtonDown routed event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
Declaration
protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseButtonEventArgs | e | The System.Windows.Input.MouseButtonEventArgs that contains the event data. The event data reports that the left mouse button was pressed. |
OnPreviewMouseMove(MouseEventArgs)
Invoked when an unhandled System.Windows.Input.Mouse.PreviewMouseMove attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
Declaration
protected override void OnPreviewMouseMove(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseEventArgs | e | The System.Windows.Input.MouseEventArgs that contains the event data. |
remove_DragEnd(CheckListBox.DragCheckListBoxHandler)
Declaration
public void remove_DragEnd(CheckListBox.DragCheckListBoxHandler value)
Parameters
Type | Name | Description |
---|---|---|
CheckListBox.DragCheckListBoxHandler | value |
remove_DragStart(CheckListBox.DragCheckListBoxHandler)
Declaration
public void remove_DragStart(CheckListBox.DragCheckListBoxHandler value)
Parameters
Type | Name | Description |
---|---|---|
CheckListBox.DragCheckListBoxHandler | value |
SetCheckBoxAlignment(DependencyObject, CheckBoxAlignment)
Assigns the alignment of the System.Windows.Controls.CheckBox.
Declaration
public static void SetCheckBoxAlignment(DependencyObject obj, CheckBoxAlignment value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | obj | The obj contains the System.Windows.DependencyObject. |
CheckBoxAlignment | value | The value of CheckBoxAlignment. |
Events
DragEnd
Occurs when items dragging ends to drop the items into the other CheckListBox control.
Declaration
public event CheckListBox.DragCheckListBoxHandler DragEnd
Event Type
Type |
---|
CheckListBox.DragCheckListBoxHandler |
Remarks
This event will be raised when the CheckListBoxItem dragging is completed.
DragStart
Occurs when items dragging starts to drop the items into the other CheckListBox control.
Declaration
public event CheckListBox.DragCheckListBoxHandler DragStart
Event Type
Type |
---|
CheckListBox.DragCheckListBoxHandler |
Remarks
This event will be raised when the CheckListBoxItem dragging started.
IsDragDropEnabledChanged
Occurs when the IsDragDropEnabled property is changed.
Declaration
public event PropertyChangedCallback IsDragDropEnabledChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
Remarks
This event is raised if the IsDragDropEnabled property is changed by either a programmatic modification or user interaction.
ItemChecked
Occurs when the CheckListBoxItem check state is changed.
Declaration
public event EventHandler<ItemCheckedEventArgs> ItemChecked
Event Type
Type |
---|
System.EventHandler<ItemCheckedEventArgs> |
Remarks
This event is raised if the check state of the CheckListBoxItem is changed by either a programmatic modification or user interaction.
SelectionChanged
Occurs when the CheckListBoxItem selection is changed.
Declaration
public event SelectionChangedEventHandler SelectionChanged
Event Type
Type |
---|
System.Windows.Controls.SelectionChangedEventHandler |
Remarks
This event occurs whenever there is a change to a selection. A selection can be changed not only by user interaction but also by binding as well as other set values.