[]
        
(Showing Draft Content)

GrapeCity.Wpf.SpreadSheet.CellType.Editors.GcComboBox

GcComboBox Class

Represents a selection control that combines a text box and a drop-down containing a list box that allows users to select an item from a list.

Namespace: GrapeCity.Wpf.SpreadSheet.CellType.Editors
Assembly: GrapeCity.Wpf.SpreadSheet.CellType.dll
Syntax
[TemplatePart(Name = "PART_Popup", Type = typeof(ComboDropDownWindow))]
[TemplatePart(Name = "PART_DropDownChild", Type = typeof(Control))]
[TemplatePart(Name = "PART_DropDownToggle", Type = typeof(ToggleButton))]
[TemplatePart(Name = "PART_EditHost", Type = typeof(Control))]
[StyleTypedProperty(Property = "DropDownButtonStyle", StyleTargetType = typeof(DropDownButton))]
[StyleTypedProperty(Property = "DropDownWindowStyle", StyleTargetType = typeof(ComboDropDownWindow))]
[StyleTypedProperty(Property = "DropDownControlStyle", StyleTargetType = typeof(Control))]
[StyleTypedProperty(Property = "EditBoxStyle", StyleTargetType = typeof(Control))]
[StyleTypedProperty(Property = "SpinButtonStyle", StyleTargetType = typeof(SpinButton))]
[TemplateVisualState(Name = "Disabled", GroupName = "CommonStates")]
[TemplateVisualState(Name = "ReadOnly", GroupName = "CommonStates")]
[TemplateVisualState(Name = "MouseOver", GroupName = "CommonStates")]
[TemplateVisualState(Name = "Normal", GroupName = "CommonStates")]
[TemplateVisualState(Name = "ActiveDropDown", GroupName = "ActiveStates")]
[TemplateVisualState(GroupName = "SpinButtonStates", Name = "SpinButtonCollapsed")]
[TemplateVisualState(GroupName = "SpinButtonStates", Name = "SpinButtonVisible")]
[TemplateVisualState(GroupName = "DropDownButtonStates", Name = "DropDownButtonCollapsed")]
[TemplateVisualState(GroupName = "DropDownButtonStates", Name = "DropDownButtonVisible")]
public class GcComboBox : ControlBase, IAnimatable, IFrameworkInputElement, IInputElement, IQueryAmbient, ISupportInitialize
<TemplatePart(Name:="PART_Popup", Type:=GetType(ComboDropDownWindow))>
<TemplatePart(Name:="PART_DropDownChild", Type:=GetType(Control))>
<TemplatePart(Name:="PART_DropDownToggle", Type:=GetType(ToggleButton))>
<TemplatePart(Name:="PART_EditHost", Type:=GetType(Control))>
<StyleTypedProperty(Property:="DropDownButtonStyle", StyleTargetType:=GetType(DropDownButton))>
<StyleTypedProperty(Property:="DropDownWindowStyle", StyleTargetType:=GetType(ComboDropDownWindow))>
<StyleTypedProperty(Property:="DropDownControlStyle", StyleTargetType:=GetType(Control))>
<StyleTypedProperty(Property:="EditBoxStyle", StyleTargetType:=GetType(Control))>
<StyleTypedProperty(Property:="SpinButtonStyle", StyleTargetType:=GetType(SpinButton))>
<TemplateVisualState(Name:="Disabled", GroupName:="CommonStates")>
<TemplateVisualState(Name:="ReadOnly", GroupName:="CommonStates")>
<TemplateVisualState(Name:="MouseOver", GroupName:="CommonStates")>
<TemplateVisualState(Name:="Normal", GroupName:="CommonStates")>
<TemplateVisualState(Name:="ActiveDropDown", GroupName:="ActiveStates")>
<TemplateVisualState(GroupName:="SpinButtonStates", Name:="SpinButtonCollapsed")>
<TemplateVisualState(GroupName:="SpinButtonStates", Name:="SpinButtonVisible")>
<TemplateVisualState(GroupName:="DropDownButtonStates", Name:="DropDownButtonCollapsed")>
<TemplateVisualState(GroupName:="DropDownButtonStates", Name:="DropDownButtonVisible")>
Public Class GcComboBox
    Inherits ControlBase
    Implements IAnimatable, IFrameworkInputElement, IInputElement, IQueryAmbient, ISupportInitialize
Remarks

The text box either displays the current selection or is empty if there is no selected item.

If you populate a combo box with items that inherit from UIElement, the selected item can only appear in the visual tree one time. This means if an item is selected, it will appear in the selection box, and not in the drop-down list of items. When it is no longer the selected item, it will reappear in the drop-down list. If items do not inherit from UIElement, they can appear in both the selection box and the drop-down list at the same time.

There are two mode to present the data items in a GcComboBox drop-down window, which is specified by the UseMultipleColumn property.

Columns and Items

Set UseMultipleColumn to true, GcComboBox will present data in a customizable grid.

By default, the GcComboBox 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.

Set UseMultipleColumn to false, GcComboBox will present data items with default presentation.
GcComboBox 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.

You can retrieve the combo box's selected item by using the SelectedItem property, or retrieve the index of the selected item by using the SelectedIndex property.

Customizing the GcComboBox Control

You can apply a style to each item displayed in the GcComboBox by setting the ItemContainerStyle property.
To apply the same property settings to multiple GcComboBox controls, use the Style property. To change the visual structure and visual behavior of a GcComboBox, copy and modify its default style and template.
Dependency properties for this control might be set by the default style of the control. If a dependency property for a GcComboBox is set by its default style, the property might change from its default value when the GcComboBox appears in the application.

Supported VisualState list:

VisualStateGroup Name

VisualState Name

Description

CommonStates

Normal

Represents the visual appearance when control is in normal state.

CommonStates

Disabled

Represents the visual appearance when IsEnabled is false.

CommonStates

MouseOver

Represents the visual appearance when IsActive is true.

ActiveStates

ActiveDropDown

Represents the visual appearance when IsActive and IsDropDownOpen is true.

ActiveStates

Active

Represents the visual appearance when IsActive is true.

ActiveStates

Inactive

Represents the visual appearance when IsActive is false.

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.

Constructors

Name Description
GcComboBox()

Initializes a new instance of the GcComboBox class.

Fields

Name Description
AllowDropDownOpenProperty

Identifies the AllowDropDownOpen dependency property.

AlternatingItemBackgroundProperty

Identifies the AlternatingItemBackground DependencyProperty.

AlternationCountProperty

Identifies the AlternationCount DependencyProperty.

AutoGenerateColumnsProperty

Identifies the AutoGenerateColumns DependencyProperty.

AutoOpenDropDownProperty

Identifies the AutoOpenDropDown dependency property.

AutoSelectProperty

Gets or sets a value that indicates whether the item is automatically selected when the prefix is entered.

CanUserResizeColumnsProperty

Identifies the CanUserResizeColumns DependencyProperty.

CanUserSortColumnsProperty

Identifies the CanUserSortColumns DependencyProperty.

CheckOnClickProperty

Identifies the CheckOnClick DependencyProperty.

ContentPathProperty

Identifies the ContentPath dependency property.

DisabledBackgroundProperty

Identifies the DisabledBackground dependency property.

DisabledForegroundProperty

Identifies the DisabledForeground dependency property.

DropDownButtonStyleProperty

Indicates the GrapeCity.Windows.InputMan.GcComboBox.DropDownButtonStyle DependencyProperty.

DropDownButtonVisibilityProperty

Identifies the GrapeCity.Windows.InputMan.GcComboBox.DropDownButtonVisibility dependency property.

DropDownControlStyleProperty

Identifies the DropDownControlStyle DependencyProperty

DropDownWidthProperty

Identifies the GrapeCity.Windows.InputMan.GcComboBox.DropDownWidth DependencyProperty.

DropDownWindowStyleProperty

Identifies the DropDownWindowStyle DependencyProperty

EditBoxStyleProperty

Identifies the EditBoxStyle dependency property.

EditableBackgroundProperty

Identifies the EditableBackground dependency property.

EditableTemplateProperty

Identifies the EditableTemplate dependency property.

ExitOnLeftRightKeyProperty

Identifies the ExitOnLeftRightKey dependency property.

FocusDropDownControlOnOpenProperty

Identifies the FocusDropDownControlOnOpen DependencyProperty

HorizontalGridLineBrushProperty

Identifies the HorizontalGridLineBrush DependencyProperty.

HorizontalGridLineStyleProperty

Identifies the HorizontalGridLineStyle DependencyProperty.

IsAutoSelectCaseSensitiveProperty

Gets or sets a value that indicates whether case is a condition when searching for items.

IsDropDownOpenProperty

Identifies the IsDropDownOpen dependency property.

IsEditableProperty

Identifies the IsEditable dependency property.

IsReadOnlyProperty

Identifies the IsReadOnly dependency property.

IsSelectableProperty

Identifies the IsSelectable dependency property.

IsSelectionBoxHighlightedProperty

Identifies the IsSelectionBoxHighlighted dependency property.

IsSynchronizedWithCurrentItemProperty

Identifies the IsSynchronizedWithCurrentItem DependencyProperty.

ItemBackgroundProperty

Identifies the ItemBackground DependencyProperty.

ItemCheckBoxVisibilityProperty

Identifies the ItemCheckBoxVisibility DependencyProperty.

ItemContainerStyleProperty

Identifies the ItemContainerStyle DependencyProperty.

ItemTemplateProperty

Identifies the ItemTemplate DependencyProperty.

ItemsSourceProperty

Identifies the ItemsSource dependency property.

MaxDropDownHeightProperty

Identifies the GrapeCity.Windows.InputMan.GcComboBox.MaxDropDownHeight DependencyProperty.

MaxDropDownItemsProperty

Identifies the GrapeCity.Windows.InputMan.GcComboBox.MaxDropDownItems DependencyProperty.

SelectedIndexProperty

Identifies the SelectedIndex dependency property.

SelectedItemProperty

Identifies the SelectedItem dependency property.

SelectedValuePathProperty

Identifies the SelectedValuePath dependency property.

SelectedValueProperty

Identifies the SelectedValue dependency property.

SelectionBoxItemProperty

Identifies the SelectionBoxItem dependency property.

SelectionBoxItemTemplateProperty

Identifies the SelectionBoxItemTemplate dependency property.

SelectionChangedEvent

Identifies the SelectionChanged routed event.

SpinButtonStyleProperty

Identifies the SpinButtonStyle DependencyProperty.

SpinButtonVisibilityProperty

Identifies the GrapeCity.Windows.InputMan.GcComboBox.SpinButtonVisibility DependencyProperty.

StaysOpenOnEditProperty

Identifies the StaysOpenOnEdit DependencyProperty

TextProperty

Identifies the Text dependency property.

UnEditableTemplateProperty

Identifies the EditableTemplate dependency property.

UseMultipleColumnProperty

Identifies the UseMultipleColumn DependencyProperty.

VerticalGridLineBrushProperty

Identifies the VerticalGridLineBrush DependencyProperty.

VerticalGridLineStyleProperty

Identifies the VerticalGridLineStyle DependencyProperty.

Properties

Name Description
AllowDropDownOpen

Gets or sets a value indicating whether allow to open drop down window or not. This is a dependency property.

AlternatingItemBackground

Gets or sets the Brush that is used to paint the background of dropdown item whose AlternationIndex is 1.

AlternationCount

Gets or sets the number of alternating item containers in the GcComboBox, which enables alternating containers to have a unique appearance. This is a dependency property.

AutoGenerateColumns

Gets or sets a value indicating whether auto generate columns. This is a dependency property.

AutoOpenDropDown

Gets or sets a bool value indicates the drop-down window auto shown when GcComboBox gets focus. This is a dependency property.

AutoSelect

Gets or sets a value that indicates whether the item is automatically selected when the prefix is entered.

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 read only dependency property.

ClearCommand

Represents the ClearCommand command, which requests that GcComboBox to clear all the text.

Columns

Gets a collection that contains all the columns in the control.

ContentPath

Gets or sets a value indicates the name of the property that is displayed in GcComboBox. This is a dependency property.

DisabledBackground

Gets or sets a brush that describes the background of a control when it is disabled.

DisabledForeground

Gets or sets a brush that describes the foreground of a control when it is disabled.

DropDownButtonStyle

Gets or sets a style which is used to render the dropdown button.

DropDownButtonVisibility

Gets or sets the GrapeCity.Windows.InputMan.ButtonVisibility of the dropdown button. This is a dependency property.

DropDownControlStyle

Gets or sets a style which is used to render the drop-down control. This is a dependency property.

DropDownWidth

Gets or sets the width of the dropdown window. This is a dependency property.

DropDownWindowStyle

Gets or sets the Style for the GrapeCity.Windows.InputMan.Primitives.DropDownWindow. This is a dependency property.

EditBoxStyle

Gets or sets a style which is used to render the edit box. This is a dependency property.

EditableBackground

Gets or sets a brush that describes the background of a control when GcComboBox.IsEditable is true.

EditableTemplate

Gets or sets a template which will be used when IsEditable is set to true. This is a dependency property.

ExitOnLeftRightKey

Gets or sets whether the focus automatically moves to the previous or next tab ordering control when pressing the left, right arrow keys.

FocusDropDownControlOnOpen

Gets or sets a value that indicates whether focus the drop-down listbox when drop-down window opened. 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.

IsAutoSelectCaseSensitive

Gets or sets a value that indicates whether case is a condition when searching for items.

IsDropDownOpen

Gets or sets a value that indicates whether the drop-down for a GcComboBox is currently open. This is a dependency property.

IsEditable

Gets or sets a value that indicates whether user can edit value in the GcComboBox. This is a dependency property.

IsReadOnly

Gets or sets a value indicating whether this control is read only.

IsSelectable

Gets or sets a value indicating whether the items can be selected.

IsSelectionBoxHighlighted

Gets a value that indicates whether highlight the selected items. This is a dependency property.

IsSynchronizedWithCurrentItem

Gets or sets a value that indicates whether the GcComboBox 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 dropdown item whose AlternationIndex is 0.

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.

ItemContainerGenerator

Gets the item container generator.

ItemContainerStyle

Gets or sets the style that is used when rendering the item containers. This is a dependency property.

ItemTemplate

Gets or sets the DataTemplate used to display each item.

Items

Gets the collection used to generate the content of the GcComboBox.

ItemsSource

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

MaxDropDownHeight

Gets or sets the maximum height of the dropdown window. This is a dependency property.

MaxDropDownItems

Gets or sets the maximum drop-down items. This is a dependency property.

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 a 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.

SelectionBoxItem

Gets the selected item in the GcComboBox. This is a dependency property.

SelectionBoxItemTemplate

Gets the template of SelectionBoxItem. This is a dependency property.

SpinButtonStyle

Gets or sets a Style which used to render GrapeCity.Windows.InputMan.Primitives.SpinButton. This is a dependency property.

SpinButtonVisibility

Gets or sets the GrapeCity.Windows.InputMan.ButtonVisibility of the spin button. This is a dependency property.

SpinDownCommand

Represents the SpinDownCommand command, which requests SpinDown button clicked.

SpinUpCommand

Represents the SpinUpCommand command, which requests SpinUp button clicked.

StaysOpenOnEdit

Gets or sets a value indicates whether a GcComboBox that is open and displays a drop-down control will remain open when a user clicks the TextBox. This is a dependency property.

SwitchDropDownCommand

Represents the SwitchDropDownCommand command, which switched the drop down window between open and closed.

Text

Gets or sets the text associated with this control. This is a dependency property.

UnEditableTemplate

Gets or sets a template which will be used when IsEditable is set to false. 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.

Methods

Name Description
BeginInit()

Starts the initialization process for this element.

EndInit()

Indicates that the initialization process for the element is complete.

GetItemDisplayIndex(int)

Gets the item displayed index.

GetItemIndex(int)

Gets the item index based on Items.

OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().

OnAutoGeneratingColumn(AutoGeneratingListColumnEventArgs)

Raises the AutoGeneratingColumn event.

OnDropDownClosed(EventArgs)

Raises the DropDownClosed event.

OnDropDownOpened(EventArgs)

Raises the DropDownOpened 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.

OnItemCheckChanged(ItemCheckEventArgs)

Raises the ItemCheck event.

OnKeyExit(KeyExitEventArgs)

Raises the KeyExit event.

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.

OnMouseEnter(MouseEventArgs)

Invoked when an unhandled MouseEnter event is raised on this element. Implement this method to add class handling for this event.

OnMouseLeave(MouseEventArgs)

Invoked when an unhandled MouseLeave event is raised on this element. Implement this method to add class handling for this event.

OnMouseLeftButtonUp(MouseButtonEventArgs)

Invoked when an unhandled MouseLeftButtonUp routed event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

OnMouseWheel(MouseWheelEventArgs)

Called before the MouseWheel event occurs to provide handling for the event in a derived class without attaching a delegate.

OnPrepareListItem(PrepareListItemEventArgs)

Raises the PrepareListItem event.

OnPreviewKeyDown(KeyEventArgs)

Invoked when an unhandled System.Windows.Input.Keyboard.PreviewKeyDown attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this 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.GcComboBox.SelectionChanged event.

OnTextChanged(RoutedEventArgs)

Is called when content in this control changes.

OnTextChanging(TextChangingEventArgs)

Raises the TextChanging event.

OpenDropDown()

Open drop down window of control.

Sort(ListColumn, ListSortDirection?)

Sorts the specified ListColumn with specific direction.

Events

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.

DropDownClosed

Occurs when the GrapeCity.Windows.InputMan.Primitives.DropDownWindow of a GcComboBox is closed.

DropDownOpened

Occurs when the GrapeCity.Windows.InputMan.Primitives.DropDownWindow of a GcComboBox is opened.

ItemCheck

Occurs when the GrapeCity.Windows.InputMan.ListItem.IsChecked is changed.

KeyExit

Occurs when input some special keys to make the control lose focus.

PrepareListItem

Occurs one time when preparing the ListItem to present the data.

SelectionChanged

Occurs when the value of the SelectedItem property on this element changes.

TextChanged

Occurs when content is changed in the text element.

TextChanging

Occurs just before the text is changed in the control.