WinForms Tips & Tricks - What You May Have Missed

WinForms Team Blog
04 July 2018

Every DevExpress release introduces some new major features that receive lots of attention in the run-up to the release. DirectX hardware acceleration, Fluent Design, vector icons and skins - you must have heard about those, if you’ve been reading our blogs and newsletters.

In addition to these big new features, we also continuously work on smaller details. In this post, I will point out a few features that you may have missed so far - hopefully they will make your developer lives easier!

Workspace Manager

You are probably aware that all major DevExpress controls - including Ribbon, Bars, Data Grid, Layout Manager, Document Manager and others - have a pair of SaveLayout and RestoreLayout methods. These helpers implement runtime settings persistence, storing changes to the registry, an XML file or a stream. In a large real-world application, this system still requires some code to be written to coordinate the persistence of the large number of individual controls. We offer a more elegant solution that automates this process further: the Workspace Manager.

This component saves and restores presets called workspaces, which include layout settings for all supported DevExpress WinForms UI Controls in a hierarchy, usually for the main form. It even provides dedicated Toolbar and Ribbon items that enable end-users to capture their own workspaces, load and save them.

Workspace Manager

If necessary, you can restrict end users from loading any but the predefined workspaces, and there are also mechanisms that filter the set of components considered for persistence.

Find documentation for the WorkspaceManager here.

Input Box

When you need to show a message with a single editor so that a user can type in a value or select one from a drop-down list, you could create a custom User Control and display it using an XtraDialog for UI consistency. But it is even easier to use our XtraInputBox instead:

var result = XtraInputBox.Show("Enter a new value", "Change Settings", "Default");

Input Box with Text Editor

The Input Box occupies the sweet spot between a simple message box and a full-fledged dialog. You can choose any DevExpress editor to display, and customize it if required.

Input Box with Date Editor

Documentation for the XtraInputBox is available here.

In addition to the Input Box, the DevExpress WinForms Subscription includes all the tools to replace standard message boxes, dialogs, hints, alerts, toast notifications, and file/folder selection dialogs with their skinned counterparts. You can see a complete list on this documentation page.

Behaviors

When our new Skin Editor was released, many customers asked us to make its Magnifier available as a separate control, since it complements color pickers nicely. We decided to introduce the Magnifier as a Behavior that can be attached to any ColorEdit descendant, providing an extra button for the editor that brings up the Magnifier.

Magnifier

There are currently twelve other Behaviors that extend or modify an attached control. For instance, the Clock Behavior styles a LabelControl or a digital Gauge as a clock:

Clock Behavior

The Stub Glyph Behavior provides placeholder icons for data records, layout items and tabs.

Stub Glyph Behavior

Note that the Persistence Behavior offers an additional approach for the settings persistence functionality described above! Documentation for all Behaviors can be found here.

If you come across a scenario that forces you to customize DevExpress controls in the same manner over and over again, please let us know and we will consider adding a new Behavior to get your job done more quickly and make the customization available to others.

Did you already know the three features mentioned in this post? We have a few more items and we will make at least a second post if you’re interested! Please share any thoughts you have, or let us know about other “easy to miss” features you have discovered yourself.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.