BinaryTreeListViewComboBoxColumn
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 | |
|---|---|
BinaryTreeListViewComboBoxColumn | Creates a combo box column whose cells are BinaryTreeListViewComboBoxCell objects. |
| Properties | |
AlphaBlendingfactorForFilterAndGroupingPanelBackColor | Gets or sets how strongly the pane colour shows when the filter and grouping pane's colour is blended with the window colour. |
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. |
AutoCompleteIsCaseSensitive | Gets or sets whether the editor's own auto-completion tells upper and lower case apart. |
AutoCompleteMode | Gets or sets how the framework's auto-completion completes what the user types in the editor. |
AutoCompleteSource | Gets or sets where the framework's auto-completion takes its suggestions from. |
CSVFileSaveAs | Gets or sets the file the multi-column drop-down's "export to CSV" command writes to. |
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. |
ColumnsToDisplay | Gets or sets which columns of DataSource the multi-column
drop-down shows, and in what order. |
ComboBoxControlFont | Gets or sets the font of the editor's text while a cell is being edited. |
ComboBoxControlFontIsSameAsDropListWindowFont | Gets or sets whether the editor's text box uses the drop-down list's font
(MultiColumnDropListFont) instead of ComboBoxControlFont. |
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. |
CustomDropDownWindowLocationPoint | Gets or sets a fixed screen position for the multi-column drop-down window. |
DropDownStyle | Gets or sets whether the editor lets the user type or only pick from the list. |
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. |
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. |
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. |
DropStyleIsMultiColumn | Gets or sets whether the editor drops down a table of several columns rather than a simple list. |
EnableAlphaBlendingForFilterAndGroupingPanelBackColor | Gets or sets whether the filter and grouping pane's colour is blended with the window colour into a paler tint. |
EnableDrawingHeaderFooterWhenInMultiColumnMode | Gets or sets whether the multi-column drop-down is framed by a header band and a footer band. |
EnableUserColumnResizing | Gets or sets whether the user can resize the multi-column drop-down's columns by dragging the edges of their headings. |
FilterAndGroupingPanelBackColor | Gets or sets the background colour of the multi-column drop-down's filter and grouping pane. |
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. |
GroupMultiColumnDisplayModeDataBasedOnThisColumn | Gets or sets the column the multi-column drop-down groups its rows by. |
HeadersToDisplay | Gets or sets the heading of each column of the multi-column drop-down, in place of the column names. |
MultiColumnDropDownSize | Gets or sets the size of the multi-column drop-down window. |
MultiColumnDropDownWindowConfiguration | Gets or sets the look of the multi-column drop-down's header, footer and column headings. |
MultiColumnDropListBackColor | Gets or sets the background colour of the multi-column drop-down's rows. |
MultiColumnDropListFont | Gets or sets the font of the multi-column drop-down's rows. |
MultiColumnDropListForeColor | Gets or sets the text colour of the multi-column drop-down's rows. |
MultiColumnDropListGridLines | Gets or sets whether the multi-column drop-down draws grid lines between its cells. |
MultiColumnDropListHoverSelection | Gets or sets whether a row of the multi-column drop-down is highlighted when the pointer rests on it, without a click. |
MultiColumnDropListWindowIsResizable | Gets or sets whether the user can resize the multi-column drop-down by dragging its edges. |
ShouldAllowDragDropOfColumns | Gets or sets whether the user can drag the multi-column drop-down's column headings to reorder the columns. |
ShowFilterOptionsInMultiColumnMode | Gets or sets whether the multi-column drop-down has a pane in which the user can filter and group the rows. |
| Methods | |
Clone | Creates a copy of the column with all its settings. |
GetOptimumWidth | Estimates the size a multi-column drop-down needs to show a table in full. |
Constructors
BinaryTreeListViewComboBoxColumn
Creates a combo box column whose cells are BinaryTreeListViewComboBoxCell objects.
Properties
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
Used while EnableAlphaBlendingForFilterAndGroupingPanelBackColor is on.
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;truefor the last.
AutoCompleteIsCaseSensitive
Gets or sets whether the editor's own auto-completion tells upper and lower case apart.
- Value
falseby default, so that typing "lee" completes to "Leeds".
Remarks
Applies while the column's AutoComplete is on.
AutoCompleteMode
Gets or sets how the framework's auto-completion completes what the user types in the editor.
- Value
Appendby default.
Remarks
The same as AutoCompleteMode, applied to each cell's editor.
See also
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
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
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
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
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
Gets or sets whether the editor's text box uses the drop-down list's font
(MultiColumnDropListFont) instead of ComboBoxControlFont.
- Value
falseby default.
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
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
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;DropDownListto allow only items from the list.
Remarks
Copied to the cell's editor when editing starts.
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.ControlDarkDarkby default.
Remarks
Copied to the cell's editor when editing starts.
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.Defaultby 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
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.Controlby default.
Remarks
Copied to the cell's editor when editing starts.
DropStyleIsMultiColumn
Gets or sets whether the editor drops down a table of several columns rather than a simple list.
- Value
falseby 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
Gets or sets whether the filter and grouping pane's colour is blended with the window colour into a paler tint.
- Value
trueby default.
Remarks
The strength of the colour is AlphaBlendingfactorForFilterAndGroupingPanelBackColor.
Applies in multi-column mode (DropStyleIsMultiColumn).
EnableUserColumnResizing
Gets or sets whether the user can resize the multi-column drop-down's columns by dragging the edges of their headings.
- Value
trueby default.
See also
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
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
falseby default, for a plain table.
Remarks
The rows are grouped by the column at GroupMultiColumnDisplayModeDataBasedOnThisColumn.
Applies in multi-column mode (DropStyleIsMultiColumn).
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
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
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
Gets or sets the look of the multi-column drop-down's header, footer and column headings.
- Value
- A
MultiColumnDropDownWindowConfigurationwith 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
Gets or sets the background colour of the multi-column drop-down's rows.
- Value
SystemColors.Windowby default.
Remarks
Applies in multi-column mode (DropStyleIsMultiColumn).
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
Gets or sets the text colour of the multi-column drop-down's rows.
- Value
SystemColors.WindowTextby default.
Remarks
Applies in multi-column mode (DropStyleIsMultiColumn).
MultiColumnDropListGridLines
Gets or sets whether the multi-column drop-down draws grid lines between its cells.
- Value
trueby default.
Remarks
Applies in multi-column mode (DropStyleIsMultiColumn).
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
falseby default.
Remarks
Highlighting a row does not choose it. Applies in multi-column mode (DropStyleIsMultiColumn).
MultiColumnDropListWindowIsResizable
Gets or sets whether the user can resize the multi-column drop-down by dragging its edges.
- Value
trueby default.
Remarks
Applies in multi-column mode (DropStyleIsMultiColumn).
ShouldAllowDragDropOfColumns
Gets or sets whether the user can drag the multi-column drop-down's column headings to reorder the columns.
- Value
trueby 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
Gets or sets whether the multi-column drop-down has a pane in which the user can filter and group the rows.
- Value
falseby default.
Remarks
Applies in multi-column mode (DropStyleIsMultiColumn).
Methods
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
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.