[]
Represents a control that displays a list of data items.
[TemplatePart(Name = "ScrollViewer", Type = typeof(ScrollViewer))]
[TemplatePart(Name = "ListHeadersPresenter", Type = typeof(ListHeadersPresenter))]
[StyleTypedProperty(Property = "SubItemStyle", StyleTargetType = typeof(SubItem))]
[StyleTypedProperty(Property = "HeaderStyle", StyleTargetType = typeof(ListHeader))]
[StyleTypedProperty(Property = "ItemCheckBoxStyle", StyleTargetType = typeof(CheckBox))]
[TemplateVisualState(Name = "Normal", GroupName = "CommonStates")]
[TemplateVisualState(Name = "Disabled", GroupName = "CommonStates")]
[TemplateVisualState(Name = "Active", GroupName = "ActiveStates")]
[TemplateVisualState(Name = "Inactive", GroupName = "ActiveStates")]
public class GcListBox : ItemsControl, IAnimatable, IFrameworkInputElement, IInputElement, IQueryAmbient, IAddChild, IContainItemStorage, ISupportInitialize
<TemplatePart(Name:="ScrollViewer", Type:=GetType(ScrollViewer))>
<TemplatePart(Name:="ListHeadersPresenter", Type:=GetType(ListHeadersPresenter))>
<StyleTypedProperty(Property:="SubItemStyle", StyleTargetType:=GetType(SubItem))>
<StyleTypedProperty(Property:="HeaderStyle", StyleTargetType:=GetType(ListHeader))>
<StyleTypedProperty(Property:="ItemCheckBoxStyle", StyleTargetType:=GetType(CheckBox))>
<TemplateVisualState(Name:="Normal", GroupName:="CommonStates")>
<TemplateVisualState(Name:="Disabled", GroupName:="CommonStates")>
<TemplateVisualState(Name:="Active", GroupName:="ActiveStates")>
<TemplateVisualState(Name:="Inactive", GroupName:="ActiveStates")>
Public Class GcListBox
Inherits ItemsControl
Implements IAnimatable, IFrameworkInputElement, IInputElement, IQueryAmbient, IAddChild, IContainItemStorage, ISupportInitialize
GcListBox is an ItemsControl, which means it can contain a collection of objects of any type (such as string, image, or panel). For more information, see the ItemsControl class.
There are two modes to present the data items in a GcListBox, which is specified by the UseMultipleColumn property.
Set UseMultipleColumn to true, GcListBox will present data in a customizable grid.
By default, the GcListBox control generates columns automatically when you set the ItemsSource or Items property.
The generated columns are of type ListCheckBoxColumn for bound bool properties,
and of type ListImageColumn for bound ImageSource
properties,
and of type ListTextColumn for all other properties.
Regardless of whether you generate columns, you can use the Columns collection to programmatically add, insert, remove, and change any columns in the control at run time. Alternatively, you can specify columns in XAML, in which case you should set AutoGenerateColumns to false. Creating your own columns enables you to use additional column types, such as the ListTemplateColumn type or custom column types. The ListTemplateColumn type provides an easy way to create a simple custom column. The SubItemTemplate property enable you to specify content templates for display.
If you set ListItem to Items or ItemsSource, you must be create ListSubItemColumn to display SubItem customized in SubItems.
In this present mode, some properties inherited from ItemsControl will not take effect, such as ItemTemplate, DisplayMemberPath, ItemsPanel.
Set UseMultipleColumn to false, GcListBox will present data items with default presentation of ItemsControl.
GcListBox will generated ListItemBase as item container for set item data. If you define the ListItem as item data,
the ListItem.Content or the SubItem.Content of the first SubItem in the SubItems
will be wrapped into the generated ListItemBase to present.
In this present mode, some properties inherited from ItemsControl will not take effect, such as
ItemsPanel.
Supported VisualState list:
VisualStateGroup Name |
VisualState Name |
Description |
---|---|---|
CommonStates |
Normal |
Represents the visual appearance when control is in normal state. |
CommonStates |
Disabled |
|
ActiveStates |
Active |
|
ActiveStates |
Inactive |
|
ValidationStates |
Valid |
Represents the visual appearance when System.Windows.Controls.Validation.GetHasError(System.Windows.DependencyObject) returns false. |
ValidationStates |
InvalidFocused |
Represents the visual appearance when System.Windows.Controls.Validation.GetHasError(System.Windows.DependencyObject) returns true and control has focus. |
ValidationStates |
InvalidUnfocused |
Represents the visual appearance when System.Windows.Controls.Validation.GetHasError(System.Windows.DependencyObject) returns true and control has no focus. |
Name | Description |
---|---|
GcListBox() | Initializes a new instance of the GcListBox class. |
Name | Description |
---|---|
AlternatingItemBackground | Gets or sets the Brush that is used to paint the background of item whose GrapeCity.Windows.InputMan.GcListBox.AlternationIndex is 1. |
AutoGenerateColumns | Gets or sets a value indicating whether auto generate columns. This is a dependency property. |
CanUserResizeColumns | Gets or sets a value that indicates whether the user can adjust column widths using the mouse. This is a dependency property. |
CanUserSortColumns | Gets or sets a value that indicates whether the user can sort columns by clicking the column header. This is a dependency property. |
CheckOnClick | Gets or sets a value indicating whether mouse click action in the ListItem will change the IsChecked property value. This is a dependency property. |
CheckedItems | Gets the all ListItems whose IsChecked property is true. This is a readonly dependency property. |
ColumnWidth | Gets or sets the standard width or automatic sizing mode of columns in the control. This is a dependency property. |
Columns | Gets a collection that contains all the columns in the control. |
HeaderHeight | Gets or sets the height of the column headers row. This is a dependency property. |
HeaderStyle | Gets or sets the style that is used when rendering the column headers. This is a dependency property. |
HorizontalGridLineBrush | Gets or sets a Brush used to paint the horizontal grid lines. This is a dependency property. |
HorizontalGridLineStyle | Gets or sets a GrapeCity.Windows.InputMan.LineStyle enumeration value that indicates the horizontal grid line style for each lines. This is a dependency property. |
HorizontalScrollBarVisibility | Gets or sets a value that indicates whether a horizontal ScrollBar should be displayed. |
IsActive | Gets a value indicating whether the control is keyboard focus within or not. |
IsSynchronizedWithCurrentItem | Gets or sets a value that indicates whether the GcListBox should keep the SelectedItem synchronized with the current item in the Items property. This is a dependency property. |
ItemBackground | Gets or sets the Brush that is used to paint the background of item whose GrapeCity.Windows.InputMan.GcListBox.AlternationIndex is 0. |
ItemCheckBoxStyle | Gets or sets the style that is used when rendering the CheckBox in the first sub item of each ListItem. This is a dependency property. |
ItemCheckBoxVisibility | Gets or sets a value that indicates the visibility of CheckBox in the first sub item of each ListItem. This is a dependency property. |
MaxColumnWidth | Gets or sets the maximum width of columns in the GcListBox. This is a dependency property. |
MinColumnWidth | Gets or sets the minimum width of columns in the GcListBox. This is a dependency property. |
MoveDownCommand | Represents the MoveDownCommand command, which moves the selected item to next one. |
MoveToEndCommand | Represents the MoveToEndCommand command, which moves the selected item to the last one. |
MoveToHomeCommand | Represents the MoveToHomeCommand command, which moves the selected item to the first one. |
MoveUpCommand | Represents the MoveUpCommand command, which moves the selected item to previous one. |
SelectedIndex | Gets or sets the displayed index of the selected item. This is a dependency property. |
SelectedItem | Gets or sets the selected item. This is a dependency property. |
SelectedValue | Gets or sets the value of the selected item, obtained by using the SelectedValuePath. This is a dependency property. |
SelectedValuePath | Gets or sets the property path that is used to get the SelectedValue property of the SelectedItem property. This is a dependency property. |
ShowHeader | Gets or sets a value that indicates the visibility of column headers. This is a dependency property. |
SubItemStyle | Gets or sets the style that is used when rendering the data of sub items. This is a dependency property. |
UseMultipleColumn | Gets or sets a value indicating whether use grid to show data. This is a dependency property. |
VerticalGridLineBrush | Gets or sets a Brush used to paint the vertical grid lines. This is a dependency property. |
VerticalGridLineStyle | Gets or sets a GrapeCity.Windows.InputMan.LineStyle enumeration value that indicates the vertical grid line style for each lines. This is a dependency property. |
VerticalScrollBarVisibility | Gets or sets a value that indicates whether a vertical ScrollBar should be displayed. |
Name | Description |
---|---|
AddSelectedHandler(DependencyObject, RoutedEventHandler) | Adds a handler for the GrapeCity.Windows.InputMan.GcListBox.Selected attached event. |
AddUnselectedHandler(DependencyObject, RoutedEventHandler) | Adds a handler for the GrapeCity.Windows.InputMan.GcListBox.Unselected attached event. |
BeginInit() | Starts the initialization process for this element. |
ClearContainerForItemOverride(DependencyObject, object) | Undoes the effects of the PrepareContainerForItemOverride(DependencyObject, object) method. |
EndInit() | Indicates that the initialization process for the element is complete. |
GetContainerForItemOverride() | Creates or identifies the element that is used to display the given item. |
GetItemDisplayIndex(int) | Gets the item displayed index. |
GetItemIndex(int) | Gets the item index based on Items. |
IsItemItsOwnContainerOverride(object) | Determines if the specified item is (or is eligible to be) its own container. |
MeasureOverride(Size) | Provides the behavior for the Measure pass of Silverlight layout. Classes can override this method to define their own Measure pass behavior. |
OnApplyTemplate() | When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate(). |
OnAutoGeneratingColumn(AutoGeneratingListColumnEventArgs) | Raises the AutoGeneratingColumn event. |
OnGotKeyboardFocus(KeyboardFocusChangedEventArgs) | Invoked when an unhandled System.Windows.Input.Keyboard.GotKeyboardFocus attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event. |
OnIsActiveChanged(RoutedEventArgs) | Invoked when an unhandled IsActiveChanged event is raised on this element. Implement this method to add class handling for this event. |
OnItemCheckChanged(ItemCheckEventArgs) | Raises the GrapeCity.Windows.InputMan.GcListBox.ItemCheck event. |
OnItemsChanged(NotifyCollectionChangedEventArgs) | Called when the value of the Items property changes. |
OnLostKeyboardFocus(KeyboardFocusChangedEventArgs) | Invoked when an unhandled System.Windows.Input.Keyboard.LostKeyboardFocus attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event. |
OnPrepareListItem(PrepareListItemEventArgs) | Raises the PrepareListItem event. |
OnPropertyChanged(DependencyPropertyChangedEventArgs) | Invoked whenever the effective value of any dependency property on this FrameworkElement has been updated. The specific dependency property that changed is reported in the arguments parameter. Overrides System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs). |
OnSelectionChanged(SelectionChangedEventArgs) | Raises the GrapeCity.Windows.InputMan.GcListBox.SelectionChanged event. |
PrepareContainerForItemOverride(DependencyObject, object) | Prepares the specified element to display the specified item. |
RemoveSelectedHandler(DependencyObject, RoutedEventHandler) | Removes a handler for the GrapeCity.Windows.InputMan.GcListBox.Selected attached event. |
RemoveUnselectedHandler(DependencyObject, RoutedEventHandler) | Removes a handler for the GrapeCity.Windows.InputMan.GcListBox.Unselected attached event. |
ScrollToIndex(int) | Causes the object to scroll into view. If it is not visible, it is aligned either at the top or bottom of the viewport. |
Sort(ListColumn, ListSortDirection?) | Sorts the specified ListColumn with specific direction. |
Name | Description |
---|---|
AutoGeneratingColumn | Occurs one time for each public, non-static property in the bound data type when the ItemsSource property is changed and the AutoGenerateColumns property is true. |
IsActiveChanged | Occurs when the value of the IsActive property on this element changes. |
ItemCheck | Occurs when the GrapeCity.Windows.InputMan.ListItem.IsChecked is changed. |
PrepareListItem | Occurs one time when preparing the ListItem to present the data. |
SelectionChanged | Occurs when the value of the GrapeCity.Wpf.SpreadSheet.CellType.Editors.GcListBox.SelectedItems property on this element changes. |