Spread WPF 18
GrapeCity.Wpf.SpreadSheet.CellType.Editors Namespace / GcComboBox Class
Members


In This Topic
    GcComboBox Class
    In This Topic
    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.
    Object Model
    GcComboBox Class
    Syntax
    'Declaration
     
    <DesignTimeVisibleAttribute(False)>
    <LicenseProviderAttribute(GrapeCity.Common.SpreadLicenseProvider)>
    <TemplatePartAttribute(Name="PART_Popup", Type=GrapeCity.Wpf.SpreadSheet.CellType.Editors.ComboDropDownWindow)>
    <StyleTypedPropertyAttribute(Property="DropDownButtonStyle", StyleTargetType=GrapeCity.Wpf.SpreadSheet.CellType.Editors.DropDownButton)>
    <TemplateVisualStateAttribute(Name="Disabled", GroupName="CommonStates")>
    <ContentPropertyAttribute("Items")>
    <XmlLangPropertyAttribute("Language")>
    <UsableDuringInitializationAttribute(True)>
    <RuntimeNamePropertyAttribute("Name")>
    <UidPropertyAttribute("Uid")>
    <TypeDescriptionProviderAttribute(MS.Internal.ComponentModel.DependencyObjectProvider)>
    <NameScopePropertyAttribute("NameScope", System.Windows.NameScope)>
    Public Class GcComboBox 
       Inherits ControlBase
    'Usage
     
    Dim instance As GcComboBox
    [DesignTimeVisible(false)]
    [LicenseProvider(GrapeCity.Common.SpreadLicenseProvider)]
    [TemplatePart(Name="PART_Popup", Type=GrapeCity.Wpf.SpreadSheet.CellType.Editors.ComboDropDownWindow)]
    [StyleTypedProperty(Property="DropDownButtonStyle", StyleTargetType=GrapeCity.Wpf.SpreadSheet.CellType.Editors.DropDownButton)]
    [TemplateVisualState(Name="Disabled", GroupName="CommonStates")]
    [ContentProperty("Items")]
    [XmlLangProperty("Language")]
    [UsableDuringInitialization(true)]
    [RuntimeNameProperty("Name")]
    [UidProperty("Uid")]
    [TypeDescriptionProvider(MS.Internal.ComponentModel.DependencyObjectProvider)]
    [NameScopeProperty("NameScope", System.Windows.NameScope)]
    public class GcComboBox : ControlBase 
    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 System.Windows.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 System.Windows.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 ListTemplateColumn.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 ListItem.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 ListItem.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 System.Windows.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 System.Windows.UIElement.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.

    Inheritance Hierarchy

    System.Object
       System.Windows.Threading.DispatcherObject
          System.Windows.DependencyObject
             System.Windows.Media.Visual
                System.Windows.UIElement
                   System.Windows.FrameworkElement
                      System.Windows.Controls.Control
                         GrapeCity.Wpf.SpreadSheet.CellType.Editors.ControlBase
                            GrapeCity.Wpf.SpreadSheet.CellType.Editors.GcComboBox

    See Also