HypernovaDesktop Components · docs
Binarymission
WinForms › Tree List View › BinaryTreeListViewComboBoxColumn

BinaryTreeListViewComboBoxColumn

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WinForms.Controls.TreeControls

A column whose cells are edited with a Binarymission combo box, which can drop down a multi-column list with sorting, grouping, filtering and export.

public class BinaryTreeListViewComboBoxColumn : DataGridViewComboBoxColumn

Inherits from / implements: DataGridViewComboBoxColumn

Remarks

Fill the list as for any DataGridViewComboBoxColumn: add to Items, or set DataSource with DisplayMember and ValueMember. The editor is a BinaryTextComboBox, and every setting of the column is copied to it when a cell starts editing, so the settings apply to every row.

Set DropStyleIsMultiColumn to drop down a table rather than a list – for example, a supplier's name, town and account number side by side – choosing the columns with ColumnsToDisplay and their headings with HeadersToDisplay.

Examples

DataTable suppliers = new DataTable();
suppliers.Columns.Add("Name");
suppliers.Columns.Add("Town");
suppliers.Columns.Add("AccountNo");
suppliers.Rows.Add("Northern Fasteners", "Leeds", "NF-0031");
suppliers.Rows.Add("Kelvin Electrical", "Glasgow", "KE-1180");
suppliers.Rows.Add("Wessex Timber", "Salisbury", "WT-0457");

BinaryTreeListViewComboBoxColumn supplierColumn = new BinaryTreeListViewComboBoxColumn
{
    Name = "Supplier",
    HeaderText = "Supplier",
    DataSource = suppliers,
    DisplayMember = "Name",
    ValueMember = "Name",
    DropStyleIsMultiColumn = true,
    ColumnsToDisplay = new[] { "Name", "Town", "AccountNo" },
    HeadersToDisplay = new[] { "Supplier", "Town", "Account" },
    MultiColumnDropDownSize = new Size(360, 160)
};
parts.Columns.Add(supplierColumn);

See also

Members at a glance

Constructors
BinaryTreeListViewComboBoxColumnCreates a combo box column whose cells are BinaryTreeListViewComboBoxCell objects.
Properties
AlphaBlendingfactorForFilterAndGroupingPanelBackColorGets or sets how strongly the pane colour shows when the filter and grouping pane's colour is blended with the window colour.
AutoCompleteBasedOnCompleteMatchWithAnItemInTheListGets or sets which item the editor's own auto-completion uses when several start with the typed text: the first, or the last.
AutoCompleteIsCaseSensitiveGets or sets whether the editor's own auto-completion tells upper and lower case apart.
AutoCompleteModeGets or sets how the framework's auto-completion completes what the user types in the editor.
AutoCompleteSourceGets or sets where the framework's auto-completion takes its suggestions from.
CSVFileSaveAsGets or sets the file the multi-column drop-down's "export to CSV" command writes to.
ColumnWidthsGets or sets the width of each column of the multi-column drop-down, in place of the widths worked out from the content.
ColumnsToDisplayGets or sets which columns of DataSource the multi-column drop-down shows, and in what order.
ComboBoxControlFontGets or sets the font of the editor's text while a cell is being edited.
ComboBoxControlFontIsSameAsDropListWindowFontGets or sets whether the editor's text box uses the drop-down list's font (MultiColumnDropListFont) instead of ComboBoxControlFont.
CustomComparerImplementorGets or sets a comparison of your own for sorting the rows of the multi-column drop-down when the user clicks a heading.
CustomDropDownWindowLocationPointGets or sets a fixed screen position for the multi-column drop-down window.
DropDownStyleGets or sets whether the editor lets the user type or only pick from the list.
DropDownWindowBorderColorGets or sets the colour of the editor's border and of the outline round its drop-down button, while a cell is being edited.
DropDownWindowDisplayOrientationGets or sets which way the multi-column drop-down extends from the cell: rightwards from its left edge, or leftwards from its right edge.
DropDownWindowPaintingColorGets or sets the accent colour the editor blends to fill its drop-down button and the highlighted item, while a cell is being edited.
DropStyleIsMultiColumnGets or sets whether the editor drops down a table of several columns rather than a simple list.
EnableAlphaBlendingForFilterAndGroupingPanelBackColorGets or sets whether the filter and grouping pane's colour is blended with the window colour into a paler tint.
EnableDrawingHeaderFooterWhenInMultiColumnModeGets or sets whether the multi-column drop-down is framed by a header band and a footer band.
EnableUserColumnResizingGets or sets whether the user can resize the multi-column drop-down's columns by dragging the edges of their headings.
FilterAndGroupingPanelBackColorGets or sets the background colour of the multi-column drop-down's filter and grouping pane.
GroupItemsWhenInMultiColumnDisplayModeGets or sets whether the multi-column drop-down opens with its rows grouped under headings, one for each different value in a column.
GroupMultiColumnDisplayModeDataBasedOnThisColumnGets or sets the column the multi-column drop-down groups its rows by.
HeadersToDisplayGets or sets the heading of each column of the multi-column drop-down, in place of the column names.
MultiColumnDropDownSizeGets or sets the size of the multi-column drop-down window.
MultiColumnDropDownWindowConfigurationGets or sets the look of the multi-column drop-down's header, footer and column headings.
MultiColumnDropListBackColorGets or sets the background colour of the multi-column drop-down's rows.
MultiColumnDropListFontGets or sets the font of the multi-column drop-down's rows.
MultiColumnDropListForeColorGets or sets the text colour of the multi-column drop-down's rows.
MultiColumnDropListGridLinesGets or sets whether the multi-column drop-down draws grid lines between its cells.
MultiColumnDropListHoverSelectionGets or sets whether a row of the multi-column drop-down is highlighted when the pointer rests on it, without a click.
MultiColumnDropListWindowIsResizableGets or sets whether the user can resize the multi-column drop-down by dragging its edges.
ShouldAllowDragDropOfColumnsGets or sets whether the user can drag the multi-column drop-down's column headings to reorder the columns.
ShowFilterOptionsInMultiColumnModeGets or sets whether the multi-column drop-down has a pane in which the user can filter and group the rows.
Methods
CloneCreates a copy of the column with all its settings.
GetOptimumWidthEstimates the size a multi-column drop-down needs to show a table in full.

Constructors

BinaryTreeListViewComboBoxColumn

public BinaryTreeListViewComboBoxColumn() : base()

Creates a combo box column whose cells are BinaryTreeListViewComboBoxCell objects.

Properties

AlphaBlendingfactorForFilterAndGroupingPanelBackColor

public int AlphaBlendingfactorForFilterAndGroupingPanelBackColor

Gets or sets how strongly the pane colour shows when the filter and grouping pane's colour is blended with the window colour.

Value
From 0, the window colour, to 255, the pane colour itself; 135 by default.
Remarks

AutoCompleteBasedOnCompleteMatchWithAnItemInTheList

public bool AutoCompleteBasedOnCompleteMatchWithAnItemInTheList

Gets or sets which item the editor's own auto-completion uses when several start with the typed text: the first, or the last.

Value
false, the default, for the first matching item in list order; true for the last.

AutoCompleteIsCaseSensitive

public bool AutoCompleteIsCaseSensitive

Gets or sets whether the editor's own auto-completion tells upper and lower case apart.

Value
false by default, so that typing "lee" completes to "Leeds".
Remarks

Applies while the column's AutoComplete is on.

AutoCompleteMode

public AutoCompleteMode AutoCompleteMode

Gets or sets how the framework's auto-completion completes what the user types in the editor.

Value
Append by default.
Remarks

The same as AutoCompleteMode, applied to each cell's editor.

See also

AutoCompleteSource

public AutoCompleteSource AutoCompleteSource

Gets or sets where the framework's auto-completion takes its suggestions from.

Value
ListItems, the column's list, by default.
Remarks

The same as AutoCompleteSource, applied to each cell's editor.

See also

CSVFileSaveAs

public string CSVFileSaveAs

Gets or sets the file the multi-column drop-down's "export to CSV" command writes to.

Value
A file path; "MultiColumnDataViewExport.csv", in the application's current folder, by default.
Remarks

The user is not asked where to save, so choose a folder the user can write to. Applies in multi-column mode (DropStyleIsMultiColumn).

ColumnWidths

public int[] ColumnWidths

Gets or sets the width of each column of the multi-column drop-down, in place of the widths worked out from the content.

Value
Widths in logical pixels, in the order the columns are shown; null, the default, to size each column to its content.
Remarks

Applies in multi-column mode (DropStyleIsMultiColumn).

ColumnsToDisplay

public string[] ColumnsToDisplay

Gets or sets which columns of DataSource the multi-column drop-down shows, and in what order.

Value
Column names (property names, for a list of objects); null, the default, to show every column.
Remarks

Every name must be a column of the data source. The headings are the names unless HeadersToDisplay gives one per column. Applies in multi-column mode (DropStyleIsMultiColumn).

See also

ComboBoxControlFont

public Font ComboBoxControlFont

Gets or sets the font of the editor's text while a cell is being edited.

Value
The default combo box font by default.
Remarks

The cell shows its value in the cell style's font when it is not being edited; set this to the same font to keep the text from changing as editing starts. Ignored while ComboBoxControlFontIsSameAsDropListWindowFont is on.

ComboBoxControlFontIsSameAsDropListWindowFont

public bool ComboBoxControlFontIsSameAsDropListWindowFont

Gets or sets whether the editor's text box uses the drop-down list's font (MultiColumnDropListFont) instead of ComboBoxControlFont.

Value
false by default.

CustomComparerImplementor

public IComparer CustomComparerImplementor

Gets or sets a comparison of your own for sorting the rows of the multi-column drop-down when the user clicks a heading.

Value
null, the default, for the built-in comparison: numbers by value, everything else as text, ignoring case.
Remarks

The comparer is given the drop-down's rows, which are ListViewItem objects; read the values from their SubItems. Applies in multi-column mode (DropStyleIsMultiColumn).

CustomDropDownWindowLocationPoint

public Point CustomDropDownWindowLocationPoint

Gets or sets a fixed screen position for the multi-column drop-down window.

Value
In screen coordinates; Point.Empty, the default, to let the editor place the window by the cell.

DropDownStyle

public ComboBoxStyle DropDownStyle

Gets or sets whether the editor lets the user type or only pick from the list.

Value
DropDown, an editable text box with a list, by default; DropDownList to allow only items from the list.
Remarks

Copied to the cell's editor when editing starts.

DropDownWindowBorderColor

public Color DropDownWindowBorderColor

Gets or sets the colour of the editor's border and of the outline round its drop-down button, while a cell is being edited.

Value
SystemColors.ControlDarkDark by default.
Remarks

Copied to the cell's editor when editing starts.

DropDownWindowDisplayOrientation

public Binarymission.WinForms.Controls.ListControls.DropDownWindowDisplayOrientation DropDownWindowDisplayOrientation

Gets or sets which way the multi-column drop-down extends from the cell: rightwards from its left edge, or leftwards from its right edge.

Value
DropDownWindowDisplayOrientation.Default by default.
Remarks

A drop-down wider than the cell, in a column near the right of the grid, fits better extending leftwards. Copied to the cell's editor when editing starts.

DropDownWindowPaintingColor

public Color DropDownWindowPaintingColor

Gets or sets the accent colour the editor blends to fill its drop-down button and the highlighted item, while a cell is being edited.

Value
SystemColors.Control by default.
Remarks

Copied to the cell's editor when editing starts.

DropStyleIsMultiColumn

public bool DropStyleIsMultiColumn

Gets or sets whether the editor drops down a table of several columns rather than a simple list.

Value
false by default.
Remarks

The table shows the columns of DataSource named in ColumnsToDisplay (all of them when that is null), headed by HeadersToDisplay; the user picks a row, and the cell takes its DisplayMember. The other multi-column settings of this column apply only while it is on.

EnableAlphaBlendingForFilterAndGroupingPanelBackColor

public bool EnableAlphaBlendingForFilterAndGroupingPanelBackColor

Gets or sets whether the filter and grouping pane's colour is blended with the window colour into a paler tint.

Value
true by default.
Remarks

The strength of the colour is AlphaBlendingfactorForFilterAndGroupingPanelBackColor. Applies in multi-column mode (DropStyleIsMultiColumn).

EnableDrawingHeaderFooterWhenInMultiColumnMode

public bool EnableDrawingHeaderFooterWhenInMultiColumnMode

Gets or sets whether the multi-column drop-down is framed by a header band and a footer band.

Value
false by default.
Remarks

The bands' text, images and colours are set in MultiColumnDropDownWindowConfiguration.

EnableUserColumnResizing

public bool EnableUserColumnResizing

Gets or sets whether the user can resize the multi-column drop-down's columns by dragging the edges of their headings.

Value
true by default.
See also

FilterAndGroupingPanelBackColor

public Color FilterAndGroupingPanelBackColor

Gets or sets the background colour of the multi-column drop-down's filter and grouping pane.

Value
Color.Empty, the default, for the editor's accent colour.
See also

GroupItemsWhenInMultiColumnDisplayMode

public bool GroupItemsWhenInMultiColumnDisplayMode

Gets or sets whether the multi-column drop-down opens with its rows grouped under headings, one for each different value in a column.

Value
false by default, for a plain table.
Remarks

The rows are grouped by the column at GroupMultiColumnDisplayModeDataBasedOnThisColumn. Applies in multi-column mode (DropStyleIsMultiColumn).

GroupMultiColumnDisplayModeDataBasedOnThisColumn

public int GroupMultiColumnDisplayModeDataBasedOnThisColumn

Gets or sets the column the multi-column drop-down groups its rows by.

Value
The zero-based position of the column in the drop-down; 0, the first column, by default.
See also

HeadersToDisplay

public string[] HeadersToDisplay

Gets or sets the heading of each column of the multi-column drop-down, in place of the column names.

Value
One heading per column shown, in the same order as ColumnsToDisplay; null, the default, to head each column with its name.
Remarks

The number of headings must match the number of columns shown, or the editor throws when it opens. Applies in multi-column mode (DropStyleIsMultiColumn).

See also

MultiColumnDropDownSize

public Size MultiColumnDropDownSize

Gets or sets the size of the multi-column drop-down window.

Value
Width and height in logical pixels; 150 by 125 by default.
Remarks

The editor scales the size to the display and keeps the window on the screen. A size the user drags the window to lasts only until the next cell is edited, when this size is applied again. Applies in multi-column mode (DropStyleIsMultiColumn).

MultiColumnDropDownWindowConfiguration

public MultiColumnDropDownWindowConfiguration MultiColumnDropDownWindowConfiguration

Gets or sets the look of the multi-column drop-down's header, footer and column headings.

Value
A MultiColumnDropDownWindowConfiguration with its default settings, created with the column.
Remarks

The header and footer are drawn while EnableDrawingHeaderFooterWhenInMultiColumnMode is on. Applies in multi-column mode (DropStyleIsMultiColumn).

MultiColumnDropListBackColor

public Color MultiColumnDropListBackColor

Gets or sets the background colour of the multi-column drop-down's rows.

Value
SystemColors.Window by default.
Remarks

Applies in multi-column mode (DropStyleIsMultiColumn).

MultiColumnDropListFont

public Font MultiColumnDropListFont

Gets or sets the font of the multi-column drop-down's rows.

Value
The default list view font by default, which means the cell style's font is used instead.
Remarks

Applies in multi-column mode (DropStyleIsMultiColumn).

MultiColumnDropListForeColor

public Color MultiColumnDropListForeColor

Gets or sets the text colour of the multi-column drop-down's rows.

Value
SystemColors.WindowText by default.
Remarks

Applies in multi-column mode (DropStyleIsMultiColumn).

MultiColumnDropListGridLines

public bool MultiColumnDropListGridLines

Gets or sets whether the multi-column drop-down draws grid lines between its cells.

Value
true by default.
Remarks

Applies in multi-column mode (DropStyleIsMultiColumn).

MultiColumnDropListHoverSelection

public bool MultiColumnDropListHoverSelection

Gets or sets whether a row of the multi-column drop-down is highlighted when the pointer rests on it, without a click.

Value
false by default.
Remarks

Highlighting a row does not choose it. Applies in multi-column mode (DropStyleIsMultiColumn).

MultiColumnDropListWindowIsResizable

public bool MultiColumnDropListWindowIsResizable

Gets or sets whether the user can resize the multi-column drop-down by dragging its edges.

Value
true by default.
Remarks

Applies in multi-column mode (DropStyleIsMultiColumn).

ShouldAllowDragDropOfColumns

public bool ShouldAllowDragDropOfColumns

Gets or sets whether the user can drag the multi-column drop-down's column headings to reorder the columns.

Value
true by default.
Remarks

With reordering allowed, the last column is not stretched to fill the window, so an empty heading area may show beside it. Applies in multi-column mode (DropStyleIsMultiColumn).

ShowFilterOptionsInMultiColumnMode

public bool ShowFilterOptionsInMultiColumnMode

Gets or sets whether the multi-column drop-down has a pane in which the user can filter and group the rows.

Value
false by default.
Remarks

Applies in multi-column mode (DropStyleIsMultiColumn).

Methods

Clone

public override object Clone()

Creates a copy of the column with all its settings.

Returns

A new BinaryTreeListViewComboBoxColumn. The MultiColumnDropDownWindowConfiguration object is shared with this column, not copied.

GetOptimumWidth

public Size GetOptimumWidth(DataTable theTable)

Estimates the size a multi-column drop-down needs to show a table in full.

Parameters
theTable
The table the drop-down will show.
Returns

An estimate in pixels: a width from the number of characters in the longest value (or column name) of each column, and a height of one line of MultiColumnDropListFont per row plus a heading row and 64 pixels. Size.Empty when theTable is null.

Remarks

The estimate is not scaled for the display. MultiColumnDropDownSize is in logical pixels, so at a display scale above 100% divide by the scale before using it there.