Every programmer needs a grid control, just like every kid needs a dog. In this first installment of Control Center, we’ll take a look at the sophisticated, hierarchical UltraGrid from Infragistics. As you’ll see, Ultragrid offers a number of impressive features. And it won’t eat your rug when you leave it in the living room unattended.
Infragistics is a relatively new name in the control vendor arena, created in January 2001 by the merger of ProtoView Development Corporation and Sheridan Software Systems. UltraGrid is available both as a component of the company’s ActiveX UltraSuite and as a stand-alone product.
If you’ve seen its sales material, you know that UltraGrid is definitely capable of some eye-popping visual effects, as Figure A, taken from one of the demo applications provided with the control, illustrates:
|Yes, that’s a fully functional data grid.|
Naturally, performance suffers mightily when UltraGrid is all tricked out like this, and I for one am not sure about the value of an alpha-blended background in an application, but it certainly looks sharp.
More than just a pretty face
Of course, when shopping for a grid control, slick UI tricks really are not all that important. You want database connectivity, customizability, stability, and ease of use. UltraGrid appears to have all these things, with an emphasis on customizability. The long list of features includes:
- Both OLE-DB bound and unbound modes with caching features.
- Drop-down list cells with customizable data lists.
- Editable cells with automatic resizing of the editing area, as well as support for control overlays during an edit.
- Display modes supporting single-pane, flat views and multiband, hierarchical views.
- Groupable, synchronizable columns, bands, and rows with predefined style types.
- Multiframe splitting capability.
- A rich object model exposing all the components of the grid.
- Inherited, overrideable UI and behavioral attributes.
Infragistics bundles several of its custom input controls with UltraGrid. When you download it for evaluation or purchase it, you’ll also get:
- ComboBoxEx, a combo-box control that supports nine layout styles, masking, previous entry search, and the ability to add new items entered by the user into the list.
- Spin, a custom spinbox control.
- Hotlink, which you can use to display a hyperlink to the Web, an e-mail address, or a registered application.
- DropDownEdit, a drop-down edit box control similar to the one found in Internet Explorer 5.
- DateEdit, a date picker control with 15 date styles.
- Currency, which can display and edit currency in 15 formats.
Let’s take a closer look at some features of UltraGrid that distinguish it from the pack.
Rich object model
While looking at UltraGrid for this review, I was the most impressed with its rich object model. Every element of UltraGrid is exposed through a programmable object. All told, there are more than 45 objects and collections exposed by the grid, making it easy for a programmer to programmatically manipulate different elements of the grid. Lower-level objects inherit some settings and attributes from their higher-level parent objects by default. For example, setting the row selection type to single row for the top-level SSUltraGrid object will also set the row selection type of all applicable children objects to the same setting, unless a custom setting has already been defined for that object through its Overrides collection. In addition, UltraGrid provides a handful of interfaces you can implement to provide various niceties, including custom data filtering, sorting, and cell animations.
Included in this object family is a generic UIElement object that UltraGrid uses to notify you when an event has fired. UIElement’sproperties can then be examined to determine which grid element fired the event. This is definitely more useful than the method of passing cell addresses or screen coordinates used by some datagrids. The UIElement object makes it simple to overlay another control, like a date-picker or a combo-box, on a cell to handle its edit event.
As I stated above, UltraGrid is completely OLE-DB compatible, meaning it can be bound to practically any data source imaginable, including a memory array. When used with Visual Basic, the control is even capable of automatically retrieving the structure of its data source at design time, allowing WYSIWYG layout control. It supports the addition of unbound or calculated columns to a bound grid and can also be used in a completely unbound state.
UltraGrid’s event model supports selective activation of events. That is, you can programmatically turn an event on or off based on the state of your application. This means that rather than examining a variable inside your event handler to determine whether or not to handle the event, you can simply disable that specific event and prevent it from firing, while leaving that element’s other events able to fire. Doing so can greatly simplify your event-handling code.
Every silver lining has a cloud
If there’s a downside to UltraGrid, it’s that Infragistics appears to have sacrificed some ease of use and performance in exchange for all this customizability. As I’ve already mentioned, utilizing some of the grid’s more advanced eye candy effects exacts a high performance cost. In addition, the rich object model can be a mixed blessing, making UltraGrid’s learning curve a little steeper than some alternatives. As a case in point, the simple act of setting the focus to a cell in the grid requires the creation of a cell object variable and a bit more code than it seems it should. However, the excellent documentation included with UltraGrid does go a long way toward smoothing these rough areas.
If you’re looking for a simple, basic grid control, you may find UltraGrid to simply be too much control for your needs. But if you are looking for a highly customizable grid control that’s capable of some outstanding UI effects and that can grow with your application, UltraGrid is probably for you.