WinForms Grid and TreeList: Using Advanced UI Controls within Data Cells

Thinking Out Loud
13 November 2014

One of the many features that sets our WinForms product line apart from others is the rich set of in-place cell editors we ship for controls such as the XtraGrid and XtraTreeList. From standard text boxes to progress bars - advanced lookups to sparklines, we've done our very best to provide a broad range of UI options for your data editing and cell presentation needs.

Over the years, however, we've learned that no matter how many in-place editors we create (and if you currently use our WinForms products, you know that we ship a lot of editors), there will be a few use-cases that our editors cannot directly address. In this upcoming release, we've taken steps to solve this dillema and give you the ability to embed custom editors for all your cell editing and data presentation needs.

The following image should give you a sense of the possibilities available to you once we release this feature in early December.

WinForms Data Grid Custom Cell Editors

As you can see, we've created a custom cell editor by using our WinForms Chart Control.

How it Works

In order to embed a custom control within the Grid or TreeList, you'll need to implement the dedicated IAnyControlEdit interface. This interface provides a straightforward way to pass a cell's value to the custom editor, calculate the control's size, perform initialization and any manual painting. The custom control can then be assigned to the target column using a RepositoryItemAnyControl object.

Infinite Possibilities

To help you visualize the potential uses for custom cell editors, this release will include updates to our Gauge Control - allowing you to display gauges directly within grid cells. Like all custom cell editors, the Gauge Control control implements the IAnyControlEdit interface and can be embedded into the DevExpress WinForms Data Grid using the RepositoryItemAnyControl object.

WinForms Data Grid Embedded Gauge Control

Note the new gauge type we've created for this release - it will be available as part of our WinForms Gauge Control Library and is being used in this sample within the Data Grid's Layout View.

As always, we welcome your comments and feedback. Let us know what you think.

8 comment(s)
Nate Laff
Nate Laff

The task screenshot is beautimus! Good work!

13 November, 2014
Crono
Crono

This looks great! :)

Out of curiosity, how well does this feature gets along with other grid functionalities, like printing, filtering and server mode?

Also, how well does it performs when a grid has over a thousand lines?

14 November, 2014
Simon Hewitt
Simon Hewitt

The TreeList version of this sounds like it would solve an immediate problem I have.

When is the beta version going to be available?

16 November, 2014
Serge (DevExpress Support)
Serge (DevExpress Support)

@Simon Hewitt

You will be able to touch the Beta within a few days. Stay tuned to our announcements.

17 November, 2014
Crono
Crono

Can anyone tell about integration with existing features and performance with large datasets please?

20 November, 2014
Ray Navasarkian (DevExpress)
Ray Navasarkian (DevExpress)

@Crono

I think you probably know the answer to some of your question :-)

For printing/export – We do not yet support export/printing of these new custom editors.. They will be exported as Text. Based on usage, we can revisit this and see how to best address the problem.

As far as performance is concerned…Mike has implemented a primitive caching engine for these editors – currently it caches up to ~50 results [bitmaps]. If you expect super fast scrolling for 10k records – it’s not going to happen. This of course depends on how fast your target control is able to render itself. In other words, if it's a chart control, it's going to take time. If it's a custom control you've written that renders quickly – things will be different.

Our current implementation was the quickest way possible to display custom controls within our containers (other than to create custom direct descendants of our editors). In theory – there are ways to use multi-threading to render custom editors, however, we want to wait and see how people are using this feature and determine what issues they encounter before we take the next step.  

20 November, 2014
Gavrilo Mumovic 1
Gavrilo Mumovic 1

Where can I find a code example of how this works?

15 December, 2014
Ray Navasarkian (DevExpress)
Ray Navasarkian (DevExpress)

You can look inside our Data Grid demo set for WinForms - we have a couple of examples (using the chart and the gauge).

15 December, 2014

Please login or register to post comments.