Class ComboBoxBaseDataBound
Represents the base class for all combos with data binding support. Like ComboBoxAdv and MultiColumnComboBox.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Tools
Assembly: Syncfusion.Tools.Windows.dll
Syntax
public abstract class ComboBoxBaseDataBound : ComboBoxBase, IThemedControl, ISupportInitialize, INonClientPaintingSupport, ISupportOffice2007Theme, IVisualStyle
Constructors
ComboBoxBaseDataBound()
Initializes a new instance of the ComboBoxBaseDataBound class.
Declaration
public ComboBoxBaseDataBound()
Remarks
Initializing this ComboBoxBase also requires you to set the ListControl property.
Properties
AllowNewText
Gets or sets a value indicating whether allowing NewText.
Declaration
public bool AllowNewText { get; set; }
Property Value
Type |
---|
System.Boolean |
DataManager
Gets the System.Windows.Forms.CurrencyManager object associated with this control.
Declaration
protected CurrencyManager DataManager { get; }
Property Value
Type |
---|
System.Windows.Forms.CurrencyManager |
DataSource
Gets or sets the data source for this System.Windows.Forms.ListControl object.
Declaration
public object DataSource { get; set; }
Property Value
Type |
---|
System.Object |
DisplayMember
Gets or sets a string that specifies the property of the data source whose contents you want to display.
Declaration
public string DisplayMember { get; set; }
Property Value
Type |
---|
System.String |
FlatStyle
Specifies the FlatStyle. (overridden property)
Declaration
public override ComboFlatStyle FlatStyle { get; set; }
Property Value
Type |
---|
ComboFlatStyle |
Overrides
IntegralHeight
Gets or sets a value indicating whether the control should resize to avoid showing partial items.
Declaration
public virtual bool IntegralHeight { get; set; }
Property Value
Type |
---|
System.Boolean |
Items
Gets an object representing the collection of the items contained in this control.
Declaration
public virtual ComboBoxBaseDataBound.ObjectCollection Items { get; }
Property Value
Type |
---|
ComboBoxBaseDataBound.ObjectCollection |
ListControl
Declaration
public override ListControl ListControl { get; set; }
Property Value
Type |
---|
System.Windows.Forms.ListControl |
Overrides
MaxDropDownItems
Gets or sets the maximum number of items to be shown in the drop-down portion of the control.
Declaration
public int MaxDropDownItems { get; set; }
Property Value
Type |
---|
System.Int32 |
SelectedIndex
Gets or sets the zero-based index of the currently selected item.
Declaration
public virtual int SelectedIndex { get; set; }
Property Value
Type |
---|
System.Int32 |
SelectedItem
Gets or sets the currently selected item in the ComboBox.
Declaration
public object SelectedItem { get; set; }
Property Value
Type |
---|
System.Object |
SelectedText
Gets or sets the text that is selected in the editable portion of the combo box.
Declaration
public string SelectedText { get; set; }
Property Value
Type |
---|
System.String |
SelectedValue
Gets or sets the value of the member property specified by the System.Windows.Forms.ListControl.ValueMember property.
Declaration
public object SelectedValue { get; set; }
Property Value
Type |
---|
System.Object |
SelectionLength
Gets or sets the number of characters selected in the editable portion of the combo box.
Declaration
public int SelectionLength { get; set; }
Property Value
Type |
---|
System.Int32 |
SelectionStart
Gets or sets the starting index of text selected in the combo box.
Declaration
public int SelectionStart { get; set; }
Property Value
Type |
---|
System.Int32 |
Sorted
Gets or sets a value indicating whether the items in the combo box are sorted.
Declaration
public bool Sorted { get; set; }
Property Value
Type |
---|
System.Boolean |
Text
Gets / sets the text associated with this control.
Declaration
public override string Text { get; set; }
Property Value
Type |
---|
System.String |
Overrides
ValueMember
Gets or sets a string that specifies the property of the data source from which to draw the value.
Declaration
public string ValueMember { get; set; }
Property Value
Type |
---|
System.String |
Methods
AddItemsCore(Object[])
Adds the specified items to the combo box.
Declaration
protected virtual void AddItemsCore(object[] value)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | value | An array of System.Object to append to the combo box. |
CreateListControl()
Creates the list control.
Declaration
protected abstract ListControl CreateListControl()
Returns
Type | Description |
---|---|
System.Windows.Forms.ListControl | Returns list control |
DetermineHeightsBasedOnFont(Graphics, ref Int32)
Called to determine the height of textArea of this control.
Declaration
protected override void DetermineHeightsBasedOnFont(Graphics g, ref int textAreaHeight)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | A System.Drawing.Graphics object. |
System.Int32 | textAreaHeight | A reference variable through which to return the height for the text area. |
Overrides
Remarks
This method expects you to return a height for the text area through the reference variable, set the height of this control (if not in ComboBoxStyle.Simple mode) and the height of the drop-down button (DropDownButtonHeight) based on the Font specified.
Dispose(Boolean)
Releases all resources used by the control.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | bool disposing |
Overrides
FilterItemOnProperty(Object)
Filters the item .
Declaration
protected object FilterItemOnProperty(object item)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item | The item that is usually an entry in the list |
Returns
Type | Description |
---|---|
System.Object | Returns an object of Filter Item |
FilterItemOnProperty(Object, String)
Declaration
protected object FilterItemOnProperty(object item, string field)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item | |
System.String | field |
Returns
Type |
---|
System.Object |
FindString(String)
Finds the first item in the combo box that starts with the specified string.
Declaration
public abstract int FindString(string s)
Parameters
Type | Name | Description |
---|---|---|
System.String | s | The string to search for. |
Returns
Type | Description |
---|---|
System.Int32 | The zero-based index of the first item found; -1 if no match is found. |
Remarks
The search performed by this method is not case-sensitive. The s parameter is a substring to compare against the text associated with the items in the combo box list. The search performs a partial match starting from the beginning of the text and returning the first item in the list that matches the specified substring. You can then perform tasks, such as removing the item that contains the search text using the Remove(Object) method or changing the item's text. Once you have found the specified text, if you want to search for other instances of the text in the ComboBoxBaseDataBound, you must use the version of the FindString method that provides a parameter for specifying a starting index within the ComboBox. If you want to perform a search for an exact word match instead of a partial match, use the FindStringExact(String) method.
FindString(String, Int32)
Finds the first item after the given index which starts with the given string. The search is not case sensitive.
Declaration
public abstract int FindString(string s, int startIndex)
Parameters
Type | Name | Description |
---|---|---|
System.String | s | The string to search for. |
System.Int32 | startIndex | The zero-based index of the item before the first item to be searched. Set to -1 to search from the beginning of the control. |
Returns
Type | Description |
---|---|
System.Int32 | The zero-based index of the first item found; -1 if no match is found. |
Remarks
The search performed by this method is not case-sensitive. The s parameter is a substring to compare against the text associated with the items in the combo box list. The search performs a partial match starting from the beginning of the text, returning the first item in the list that matches the specified substring. You can then perform tasks, such as removing the item that contains the search text using the Remove(Object) method or changing the item's text. This method is typically used after a call has been made using the version of this method that does not specify a starting index. Once an initial item has been found in the list, this method is typically used to find further instances of the search text by specifying the index position in the startIndex parameter of the item after the first found instance of the search text. If you want to perform a search for an exact word match instead of a partial match, use the FindStringExact(String, Int32) method.
FindStringExact(String)
Finds the first item in the combo box that matches the specified string.
Declaration
public abstract int FindStringExact(string s)
Parameters
Type | Name | Description |
---|---|---|
System.String | s | The string to search for. |
Returns
Type | Description |
---|---|
System.Int32 | The zero-based index of the first item found; returns -1 if no match is found. |
Remarks
The search performed by this method is not case-sensitive. The s parameter is a string to compare against the text associated with the items in the combo box list. The search looks for a match starting from the beginning of the text, returning the first item in the list that matches the specified substring. You can then perform tasks, such as removing the item that contains the search text using the Remove(Object) method or changing the item's text. Once you have found the specified text, if you want to search for other instances of the text in the ComboBoxBaseDataBound, you must use the version of the FindStringExact method that provides a parameter for specifying a starting index within the ComboBox. If you want to perform partial word search instead of an exact word match, use the FindString(String) method.
FindStringExact(String, Boolean)
Finds the first item in the combo box that matches the specified string.
Declaration
public abstract int FindStringExact(string text, bool ignoreCase)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | Text to search. |
System.Boolean | ignoreCase | Indicates whether to ignore case during serach. |
Returns
Type | Description |
---|---|
System.Int32 | Index of specified text in list; -1, if nothing found. |
FindStringExact(String, Int32)
Finds the first item after the specified index that matches the specified string.
Declaration
public abstract int FindStringExact(string s, int startIndex)
Parameters
Type | Name | Description |
---|---|---|
System.String | s | The string to search for. |
System.Int32 | startIndex | The zero-based index of the item before the first item to be searched. Set to -1 to search from the beginning of the control. |
Returns
Type | Description |
---|---|
System.Int32 | The zero-based index of the first item found; returns -1 if no match is found. |
Remarks
The search performed by this method is not case-sensitive. The s parameter is a string to compare against the text associated with the items in the combo box list. The search looks for a match starting from the beginning of the text, returning the first item in the list that matches the specified substring. You can then perform tasks, such as removing the item that contains the search text using the Remove(Object) method or changing the item's text. This method is typically used after a call has been made using the version of this method that does not specify a starting index. Once an intial item has been found in the list, this method is typically used to find further instances of the search text by specifying the index position in the startIndex parameter of the item after the first found instance of the search text. If you want to perform partial word search instead of an exact word match, use the FindString(String, Int32) method.
GetItemText(Object)
Returns the text associated with an item.
Declaration
public string GetItemText(object item)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item | The item that is usually an entry in the list. |
Returns
Type | Description |
---|---|
System.String | The item's text. |
GetListNCHeight()
Returns height of NonClientArea of ListControl.
Declaration
protected virtual int GetListNCHeight()
Returns
Type | Description |
---|---|
System.Int32 | Returns height of NonClientArea of ListControl |
GetPopupText()
Gets the popup text.
Declaration
protected override string GetPopupText()
Returns
Type | Description |
---|---|
System.String | Returns popup text |
Overrides
InitListControl(ListControl)
Declaration
protected virtual void InitListControl(ListControl listControl)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.ListControl | listControl |
NativeAdd(Object)
Declaration
protected virtual void NativeAdd(object item)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item |
NativeClear()
Declaration
protected virtual void NativeClear()
NativeInsert(Int32, Object)
Declaration
protected virtual void NativeInsert(int index, object item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | |
System.Object | item |
NativeRemoveAt(Int32)
Declaration
protected virtual void NativeRemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
OnBindingContextChanged(EventArgs)
Declaration
protected override void OnBindingContextChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e |
OnDataManagerPositionChanged()
Declaration
protected abstract void OnDataManagerPositionChanged()
OnDataSourceChanged(EventArgs)
Raises the DataSourceChanged event.
Declaration
protected virtual void OnDataSourceChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | The System.EventArgs instance containing the event data. |
OnDisplayMemberChanged(EventArgs)
Raises the DisplayMemberChanged event.
Declaration
protected virtual void OnDisplayMemberChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | The System.EventArgs instance containing the event data. |
OnDropDownStyleChanged(EventArgs)
Raises the DropDownStyleChanged event.
Declaration
protected override void OnDropDownStyleChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | An EventArgs that contains the event data. |
Overrides
OnEnter(EventArgs)
Declaration
protected override void OnEnter(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e |
Overrides
OnFontChanged(EventArgs)
Raises the System.Windows.Forms.Control.FontChanged event.
Declaration
protected override void OnFontChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | An System.EventArgs that contains the event data. |
Overrides
OnHandleDestroyed(EventArgs)
Raises the System.Windows.Forms.Control.HandleDestroyed event.
Declaration
protected override void OnHandleDestroyed(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | An System.EventArgs that contains the event data. |
Overrides
OnKeyPress(KeyPressEventArgs)
Raises KeyPress event and resets the list control if the popup is not showing.
Declaration
protected override void OnKeyPress(KeyPressEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.KeyPressEventArgs | e | EventArgs that contains the event data. |
Overrides
OnLeave(EventArgs)
Declaration
protected override void OnLeave(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e |
OnListSelectedValueChangedWhileNotShowingPopup(Int32)
Declaration
protected override void OnListSelectedValueChangedWhileNotShowingPopup(int newIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | newIndex |
Overrides
OnNewListItemKeyedIn(Int32)
Declaration
protected override bool OnNewListItemKeyedIn(int indexFound)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | indexFound |
Returns
Type |
---|
System.Boolean |
Overrides
OnPopupClosed(PopupClosedEventArgs)
Called when the popup is closed.
Declaration
protected override void OnPopupClosed(PopupClosedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
PopupClosedEventArgs | e |
Overrides
OnSelectedIndexChanged(EventArgs)
Raises the SelectedIndexChanged event.
Declaration
protected virtual void OnSelectedIndexChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | The System.EventArgs instance containing the event data. |
OnSelectedItemChanged(EventArgs)
Declaration
protected virtual void OnSelectedItemChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e |
OnSelectedValueChanged(EventArgs)
Raises the SelectedValueChanged event.
Declaration
protected virtual void OnSelectedValueChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | The System.EventArgs instance containing the event data. |
OnSelectionChangedByKey()
Declaration
protected override void OnSelectionChangedByKey()
Overrides
OnSelectionChangedOnPopupClose()
Called when selection changed on popup close].
Declaration
protected override void OnSelectionChangedOnPopupClose()
Overrides
OnTextBoxKeyUp(KeyEventArgs)
Raises the text box KeyUp event.
Declaration
protected override void OnTextBoxKeyUp(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.KeyEventArgs | e | The System.Windows.Forms.KeyEventArgs instance containing the event data. |
Overrides
Remarks
Keys.Delete and Keys.Back are not caught in Keypress
OnTextChanged(EventArgs)
Declaration
protected override void OnTextChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e |
OnUpdateSelectionBeforeValidate()
Declaration
protected override void OnUpdateSelectionBeforeValidate()
Overrides
OnValidating(CancelEventArgs)
Raises the validating event.
Declaration
protected override void OnValidating(CancelEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.CancelEventArgs | e | The System.ComponentModel.CancelEventArgs instance containing the event data. |
Overrides
OnValueMemberChanged(EventArgs)
Raises the ValueMemberChanged event.
Declaration
protected virtual void OnValueMemberChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | The System.EventArgs instance containing the event data. |
OtherChangesMade()
Overriden. Indicates whether selected index of the ListControl has been changed.
Declaration
protected override bool OtherChangesMade()
Returns
Type | Description |
---|---|
System.Boolean | TRUE if index has been changed; FALSE otherwise. |
Overrides
PerformAllowNewText(Message)
Verifies whether new text is allowed to be entered from native message.
Declaration
public override bool PerformAllowNewText(Message m)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Message | m | The message. |
Returns
Type | Description |
---|---|
System.Boolean | True if the message is handled. |
Overrides
SetItemCore(Int32, Object)
Sets the internal items.
Declaration
protected virtual void SetItemCore(int index, object value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index of item. |
System.Object | value | The value. |
SetItemsCore(IList)
Declaration
protected virtual void SetItemsCore(IList items)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IList | items |
SetPopupText(String)
Sets the popup text.
Declaration
protected override void SetPopupText(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value. |
Overrides
SetSelectedText(String, Int32)
Sets the selected text.
Declaration
protected override void SetSelectedText(string text, int foundIndex)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text. |
System.Int32 | foundIndex | Index of the found item. |
Overrides
ShouldSerializeText()
Indicates whether the Text property should be serialized in the designer.
Declaration
public virtual bool ShouldSerializeText()
Returns
Type | Description |
---|---|
System.Boolean | Return true if string is not empty |
ToString()
Declaration
public override string ToString()
Returns
Type |
---|
System.String |
UpdateListBoxBorderStyle()
Declaration
protected virtual void UpdateListBoxBorderStyle()
Events
DataSourceChanged
Occurs when the DataSource changes.
Declaration
public event EventHandler DataSourceChanged
Event Type
Type |
---|
System.EventHandler |
DisplayMemberChanged
Occurs when the DisplayMember property changes.
Declaration
public event EventHandler DisplayMemberChanged
Event Type
Type |
---|
System.EventHandler |
SelectedIndexChanged
Occurs when the SelectedIndex property has changed.
Declaration
public event EventHandler SelectedIndexChanged
Event Type
Type |
---|
System.EventHandler |
SelectedValueChanged
Occurs when the SelectedValue property changes.
Declaration
public event EventHandler SelectedValueChanged
Event Type
Type |
---|
System.EventHandler |
ValueMemberChanged
Occurs when the ValueMember property changes.
Declaration
public event EventHandler ValueMemberChanged
Event Type
Type |
---|
System.EventHandler |