EWSoftware Windows Forms List Controls


EWSoftware Windows Forms List Controls Features

The EWSoftware List Control Library is a set of extended .NET Windows Forms list controls. The controls include an auto-complete combo box, a multi-column combo box, a user control drop-down combo box, a radio button list, a check box list, a data navigator control, and a data list control (similar in nature to a continuous details section in Microsoft Access, the DataList web server control, or the DataRepeater from VB6). The current version supports .NET 2.0 through .NET 3.5.

Common Features

All of the list controls in this library share a common set of features:
  • The controls supports various data source types just like other .NET controls such as the standard combo box (data sets, data views, data tables, array lists or any other collection object that implement the IList interface, and simple strings).
  • The controls have item indexer properties that allow you to retrieve any column value by name from the data source for the currently selected item or any row in the data source. Any column value from the data source can be retrieved, not just those used as the display and value members.
  • For the combo box controls, the Items collection is sortable in ascending or descending order if not using a data source (i.e. items are added directly to the Items collection).
  • Design-time support is included for defining formatting, layout, data source, and many other control properties.

The Radio Button List Control and Its Features

The RadioButtonList control provides a single-selection radio button group that supports data binding, layout options, and data source indexers. It provides a similar set of properties as the combo-box control for working with the selected item (i.e. SelectedIndex, SelectedValue, etc.). It also provides the following features:
  • The radio button list supports four different layout methods (single column, single row, down then across, and across then down). For the last two, the control will automatically lay out the radio buttons in columns using a best fit algorithm. Properties are also provided to let you modify the padding around the list and between columns and rows.
  • The radio button list is resizable at runtime and can scroll both vertically and horizontally when necessary to display items that exceed the bounds of the control.
  • The control supports an image list to display images for each radio button entry. Images can be displayed with or without text.
  • Alignment properties are provided for the checkmark, image, and text so that you can define the layout of the radio button entries in the list.
  • The control supports displaying entries as normal radio buttons or as button controls without the checkmark.
  • An optional title can be displayed on the border above the list.
  • The radio buttons are Windows XP theme-aware.

The Checkbox List Control and Its Features

The CheckBoxList control provides a multi-selection checkbox group that supports data binding, layout options, and data source indexers. It provides the same set of properties and features as the RadioButtonList control shown above (using checkboxes instead) and provides the following additional features:
  • The Checked and CheckState properties of any checkbox in the list can be retrieved or set by index (numeric) position or by key (ValueMember) value.
  • The indices of the checked items or the values of the checked items from the data source can be returned using the CheckedIndices and CheckedItems properties.
  • The checkbox list can use three-state checkboxes (checked, unchecked, and indeterminate).
  • Each checkbox in the list can be bound to an individual field in another data source using the BindingMembers and BindingMembersDataSource properties.
  • By setting the BorderStyle to Sunken, the ListBackColor to Window, and the FlatStyle to Flat you can simulate a CheckedListBox control's appearance but gain access to all of the additional features of the CheckBoxList control such as data binding, layout options, formatting, an image list, data source indexers, setting the check state of items by key, etc.

The Combo Box Controls and Their Features

The AutoCompleteComboBox is identical to the standard combo box control with the addition of auto-completion to select matching entries as the user types text. The auto-complete feature is available in all combo box styles (DropDown, DropDownList, and Simple).

The MultiColumnComboBox provides the same features as the standard combo box control but with a drop-down list that is capable of showing multiple columns of information. It also provides the following features:

  • The control supports auto-completion in all combo box styles to select matching entries as the user types text.
  • Various new events have been added and behavior changes made to fix problems that are present in the standard combo box control.
  • Unlike other implementations of multi-column combo boxes, the form hosting the control will not lose focus. Instead, the control acts like the normal combo box allowing the parent form to retain focus and the text box portion to retain the keyboard cursor.
  • The drop-down portion auto-sizes itself when first displayed based on the defined settings. It also positions itself correctly on the screen either below or above the combo box to show the maximum number of items based on its defined settings.
  • The drop-down portion is resizable at runtime and can scroll both vertically and horizontally when necessary. The Simple combo box style is also supported.
  • If no column settings are defined, the drop-down will display all columns from the data source with basic formatting.
  • If type information is available in the data source, the drop-down will automatically show boolean values using a checkbox column.
  • A ColumnFilter property allows you to let the drop-down add the data source columns automatically but limits them to the ones that you specify.
  • For finer control over the columns displayed as well as their formatting options, column style definitions can be used to specify the columns to display in the drop-down as well as their format (alignment, column header text, format string, null text, width, etc).
  • When defining column styles, you can use the standard text box or boolean data grid columns supplied with .NET or you can use custom third-party column types such as label columns, image columns, progress bar columns, etc (all drop-down data is read-only).
  • If you define drop-down column styles, setting the Width property to -1 will cause the drop-down to size the column to the preferred width. Setting the width to zero will cause the drop-down to size the column to the longest value in the data source for the column. Setting the width to any other positive value will size the column to the specified width.

The UserControlComboBox provides the same features as the standard combo box control but with a drop-down that is capable of showing any user control that you define. It also provides the following features:

  • Various new events have been added and behavior changes made to fix problems that are present in the standard combo box control.
  • The control supports auto-completion in all combo box styles to select matching entries as the user types text.
  • The drop-down portion displays a user control that you create and derive from the supplied DropDownControl class. This allows it to show non-standard lists such as tree views, list views, or any combination of controls that you can imagine. For this control, the parent form will lose the focus when the drop-down is displayed so that controls within the drop-down can gain the focus.
  • The drop-down portion auto-sizes itself when first displayed based on the defined user control. It also positions itself correctly on the screen either below or above the combo box to show as much of the user control as possible.
  • The drop-down portion is resizable at runtime and can scroll both vertically and horizontally when necessary. The Simple combo box style is also supported.

The Data List Controls and Their Features

The DataList control allows you to specify a user control template that is used to display and edit information from a data source similar in nature to the DataList web server control, the subform control or continuous forms detail section in a Microsoft Access form, or the DataRepeater control from Visual Basic 6. It provides the following features:
  • Add, update, and delete behavior is detected based on the data source and each behavior can also be disabled via properties on the control.
  • If additions are allowed, the data list will display a "new row" placeholder at the end of the list. A new row is automatically added to the data source if you modify any of the controls in the placeholder row template.
  • The control will refresh the displayed rows automatically if it detects changes to its data source such as rows directly added to or removed from the data source or direct changes made to fields in a row in the data source rather than through the row template.
  • The control supports data set relationships so you can use it to edit information displayed in a master/detail format.
  • Navigation controls are provided that let you move from record to record, jump to a specific record, delete a row, and jump to the new row item.
  • A caption area can be displayed at the top of the data list similar to the caption option in the DataGrid control.
  • A customizable separator can be shown to provide a dividing line between rows in the list.
  • A row header can be shown to indicate the currently selected row. An indicator is also displayed on the new row item when it does not have the focus.
  • If row headers are visible, one or more rows can be selected by clicking on a row header and dragging the mouse. Shift-clicking the mouse on a row header can be used to extend the selection up or down. Methods and properties are also provided to set the row selection range.
  • Clicking and dragging in the row headers within the current selection will fire the BeginDrag event so that you can initiate a drag and drop operation.
  • Various events are provided to let you add functionality for occurrences such as rows being data bound, adding a row, deleting a row, a row being made the current row, etc.
  • A user control derived from the supplied TemplateControl class is used to provide a means for displaying and editing rows from the data source. This template can contain any controls in any layout that you need to display and edit information (text boxes, combo boxes, list boxes, radio buttons, etc).
  • The template controls for each row are initialized and bound as they are scrolled into view to save time and resources. This makes it ideal for small data sets and still makes it responsive when dealing with much larger data sets. It also lets you customize the formatting of elements on a row-by-row basis (i.e. color-code fields in each row based on their value, etc).
  • User controls derived from the TemplateControl class can also be specified to provide a header and/or footer for the data list. The header and footer are placed in fixed positions vertically but will scroll horizontally with the data rows if necessary. As with the data rows, the header and footer templates can contain any controls in any layout that you need to display and edit information (text boxes, combo boxes, list boxes, radio buttons, etc). Since the header and footer templates are fixed, they are bound to the data source as a whole rather than to individual rows within the data source. Information in bound fields in the header and footer will update as you move from row to row in the detail section.
  • Definable shortcut keys are provided to let you delete rows in the data source, jump to the new row item, jump to the row number navigation text box, and to switch between the header, detail, and footer sections.
  • Hitting the Escape key will cancel changes to the current row.
  • Ctrl+Tab and Ctrl+Shift+Tab let you tab out of the data list to the following or preceeding control on the form. When tabbing back into the data list, the last focused row will regain the focus.
  • A ClickableLabel control is provided so that clicking a label in a row template will give it the focus. This can also be used in other forms to focus a control when its associated label is clicked.

The Data Navigator Control and Its Features

The DataNavigator control allows you to navigate through a data source using a set of VCR-style buttons displaying one row at a time.
  • Add, update, and delete behavior is detected based on the data source and each behavior can also be disabled via properties on the control.
  • The control supports data set relationships so you can use it to edit information displayed in a master/detail format.
  • Navigation controls are provided that let you move from record to record, jump to a specific record, delete a row, and add a new row.
  • Various events are provided to let you add functionality for occurrences such as adding a row, deleting a row, a row being made the current row, etc.
  • Definable shortcut keys are provided to let you delete rows in the data source, add a new row to the data source, and jump to the row number navigation text box.
  • Hitting the Escape key will cancel changes to the current row.

Screen Shots

Click the images for a larger view.

Click for larger image      Click for larger image

The RadioButtonList shown above is using the Down Then Across layout style, a raised border, and optional title text. The CheckBoxList shown above is using the Across Then Down layout style with a demo image list, a sunken border, flat checkboxes, and a white background.

Click for larger image      Click for larger image

The images above show examples of the MultiColumnComboBox (left) and the UserControlComboBox (right). The example supplied with the demo displays a tree view control in the drop-down with the option to filter out discontinued items from the data source.

Click for larger image      Click for larger image

The images above show examples of the DataList control (left) and the DataNavigator (right). The DataList is shown with its various parts labelled. The DataNavigator is shown in use with a DataList that can be used to edit phone numbers related to the currently displayed name and address. The checkbox list and radio button lists on the form also demonstrate support for data binding them to items in the navigator's data source.

Demo Applications

Windows Forms applications in C# and VB.NET are provided that demonstrate the basic use of the various list controls. For the combo box demos, the form presents an auto-complete and a multi-column or user control combo box control. A property grid can be used to modify the multi-column/user control combo box's properties at runtime to try out its various features. The radio button list and checkbox list demos work in a similar fashion. The data list demo provide a simple template for editing rows in the supplied name and address database and provides an example of how to implement templates for your own data list needs. It also contains examples of drag and drop operations utilizing the data list. The data navigator demo uses the same name and address database but displays the information one row at a time using the data navigator control. An example is also provided that shows the use of the data navigator in conjunction with a data list to edit names and addresses and related phone number information.

Download the Shareware Version

The shareware version of the EWSoftware List Controls Library can be downloaded here:

NOTE: The combo box and data list controls in the shareware version render a tag and a reference to this page in the footer of their list portions. These do not appear in the licensed version.

The supplied demo projects are Visual Studio 2005 projects but can be opened and converted to Visual Studio 2008 projects without any problems.

New Feature Requests

The components in this library provide an extensive set of features. However, everyone has different needs, some of which might not have been anticipated. If you find that these controls are missing features that you need, please feel free to make a request to have them added. Every effort will be made to work them into a future release.

Purchase a Licensed Version

A single user license or a site license can be purchased. The single user license is for a single developer on a single PC. The site license is for any number of developers at a single location. The licensed version contains fully commented C# source code for all classes and controls in the library. Technical support and bug fixes will be supplied to licensed users free of charge. Once purchased, distribution of the assemblies containing the classes and controls with your applications is royalty-free (see the enclosed license agreement for full details).

Payment and Delivery

For fastest delivery, please choose a payment option below. Payment is handled via PayPal and you will be e-mailed a URL within two (2) business days that allows you to download the licensed version from this site. If you would prefer to pay by an alternate method such as check or money order, please contact the author directly at Eric@EWoodruff.us. Thank you!

NOTE: The download URL will be sent to the e-mail address on the PayPal invoice. If you would like it sent to an alternate e-mail address, please e-mail a note containing the alternate e-mail address at the same time payment is made.


Single User License - $75.00 per user


Site License - $375.00 per location

Revision History

09/10/2006 1.2.0.8 - Minor update. Changes made in this release:
  • Added the IsBinding property to the DataList control which can be checked to see if binding is currently taking place so that you can suppress event handlers that may have unwanted results when binding is happening.
  • Fixed the DataList control so that if you scroll the list and then click on a row header when the DataList control does not have the focus, the row associated with the header correctly received the focus.
  • Fixed the BaseComboBox control so that it correctly fires all key-related events.
05/01/2006 1.2.0.5 - Minor update. Changes made in this release:
  • Fixed height calculation in BaseButtonList in .NET 2.0 so that it doesn't clip the items.
  • Fixed the MultiColumnComboBox so that when the mouse wheel is used to scroll the drop-down in DropDown and DropDownList mode, it does not change the current selection until an item is clicked.
  • Added the MouseTracking property to MultiColumnComboBox to allow disabling the selection tracking with the mouse cursor in the drop-down in DropDown and DropDownList modes.
  • Added a UseMnemonic property to BaseButtonList so that you can specify whether items in the CheckBoxList and RadioButtonList interpret the ampersand (&) character in the display text as a mnemonic or as a literal.
  • Added ClearSelections and SelectAll methods to CheckBoxList to clear all checked items and to check all items respectively.
03/06/2006 1.2.0.4 - Major Update. Changes made in this release:
  • A separate build is now available for .NET 2.0 / Visual Studio 2005.
  • Fixed several problems that were discovered with the support for related data sources when used in conjunction with DataList controls. See the tutorial for a couple of known issues and their workarounds.
  • Fixed the DefaultSelection property on the drop-down controls so that it could be set at design time.
  • Fixed the MultiColumnComboBox so that if its data source is a data set and its value member property references a relationship in it the information is correctly loaded into its drop-down.
  • Fixed a bug that caused an exception when the combo box controls where dropped on the form at design-time.
  • Made some more modifications to the combo boxes to fix a problem with them disposing of their drop-downs when updates are pushed into their data source while the drop-down is being displayed.
  • Prevented the mouse wheel event from propagating to the parent in the combo box controls so that the parent doesn't scroll too if it can.
  • Fully qualified the designer attribute values again to allow their use from within the demo application forms.
  • Significantly improved DataList redraws when scrolling. It now scrolls by row height which reduces the number of times it redraws during repeated scroll events. Items are also initialized and bound during the scroll before they become visible which also helps during the initial scroll through the list.
  • When dragging the DataList's vertical scrollbar thumb, a tooltip now appears under the mouse cursor showing the row number of the topmost visible row and the total number of rows as you scroll through them.
  • Page up and Page Down can now be used to scroll through the rows in a DataList. Ctrl+Page Up and Ctrl+Page Down can be used to jump to the start and end of the list. If a multi-line textbox has the focus and all of its text is not selected, the data list will ignore the key and let the textbox handle it instead which is more likely the desired behavior in that case.
  • Added Find, FindString, and FindStringExact methods to the DataList and DataNavigator controls to allow for searching for an item or a string in a member of the data source. The demos have been updated with an incremental search feature to show an example use of the FindString method.
01/02/2006 1.1.0.2 - Minor update. Changes made in this release:
  • Fixed the DataList control so that it works correctly with related data sources. The demo has been modified to include an example of using the data navigator in conjunction with a data list to edit addresses and phone numbers using a data set with a relationship between the two tables that it contains.
  • Added CaptionVisible, CaptionText, CaptionBackColor, CaptionForeColor, and CaptionFont properties to the DataList control so that a caption can be displayed in the list similiar to the caption in a DataGrid control.
12/20/2005 1.1.0.1 - Major update. Changes made in this release:
  • Breaking Changes
    • The Padding class and the Padding property on the BaseButtonList class have been renamed ListPadding to avoid a conflict with the new .NET 2.0 Padding class. This change affects the RadioButtonList and CheckBoxList controls.
    • The BorderStyle property and BorderStyleChanged event were removed from the BaseComboBox class. The drawing style is now determined by the FlatStyle property to be consistent with the standard .NET combo box control. This change affects the MultiColumnComboBox and UserControlComboBox controls.
    • The TemplateControl.ChangePolicyModified method now has no parameter. It was redundant to pass it the values as it can simply look at the allow additions/edits/deletions properties on its parent.
  • Fixed a problem with the MultiColumnComboBox that could cause it to access its drop-down after it was disposed due to changes being committed to bound controls during the drop-down process.
  • Fixed the UserControlDropDown so that the parent form always regains the focus when it is modal.
  • Fixed the DataList so that when you tab into it and there are no rows, the new row template gains the focus.
  • Fixed mnemonic processing so that when the DataList does not have the focus it processes mnemonics in the selected row rather than the first row. If the selected row does not handle the mnemonic, then the header and footer controls are given a chance to handle it if they have been defined.
  • Fixed mnemonic processing within the row template so that focus goes to the control in the current row template rather than the next row when the focus is past the control associated with the mnemonic.
  • Suppressed scaling of row templates in the DataList control to prevent issues with odd sizing behavior when the data list is bound before the form becomes visible and the form was developed on a system using large fonts but runs on a system using small fonts and vice versa.
  • Added the property IsUndoing to the DataList control. Row templates can check this to see if they need to suppress event handlers such as SelectedIndexChanged when changes are being cancelled.
  • Added an AutoEllipsis property to ClickableLabel to allow displaying text without wrapping it. This is similar to the identically named property in the .NET 2.0 label control that has a similar purpose.
  • Added data source indexers to the AutoCompleteComboBox to make it consistent with the other controls in the library.
  • Added support for the RightToLeft property to the MultiColumnComboBox and UserControlComboBox controls.
  • The MultiColumnComboBox and UserControlComboBox controls now draw using the current Windows XP theme if the application supports themes and the FlatStyle property is set to Standard or System. In addition, the Flat and Popup styles now match the flat drawing style of the .NET 2.0 combo box control.
  • Several changes have been implemented to make the development of row templates simpler, to minimze the chances of making some of the common errors, and to greatly reduce the amount of code that you need to write. See the DataList control tutorial for more information on the following changes:
    • Added a new SharedDataSources property to the DataList control. This can be used to hold common data sources shared amongst all template instances for controls that they contain such as combo boxes. This saves having to add static properties and code to the template to maintain the shared data sources as in past versions.
    • Added a new overloaded AddBinding method to TemplateControl to make it simpler to create data bindings on controls. You no longer have to clear each control's bindings and then recreate them as the AddBinding method will do it for you. Overloads are given to add additional bindings to the same control and to add bindings with Parse and/or Format event handlers.
    • Added a DeleteRow method to TemplateControl to make it easier to delete the row related to the template.
10/31/2005 1.0.0.0 - Initial release.


   
Updated Saturday, February 21, 2009 Copyright © 1998-2009 Eric Woodruff, All rights reserved
Send mail to Eric@EWoodruff.us