A newer version of this page is available. Switch to the current version.

Behaviors

  • 3 minutes to read

A Behavior is an appearance and\or functionality preset for controls. For instance, you can use the Clock Behavior to turn a LabelControl or a digital gauge into a clock.

Behaviors - Clock Behavior

You can submit Support Center tickets to request new Behaviors.

Attach a Behavior to a Control

Open Visual Studio's Toolbox and drag-and-drop the Behavior Manager component onto the form. Click the component’s smart tag and select "Edit Behaviors" to invoke the Collection Editor dialog.

Behaviors - Component Smarttag

This dialog allows you to create new Behaviors, and use their Target properties to assign them to controls.

Behaviors - Collection Editor

You can use the "Add Behaviors..." link in a control’s smart tag menu to add the Behavior Manager component and open its Collection Editor dialog.

Behaviors - Attach Behavior

To attach Behaviors in code, call the Behavior Manager's Attach method and use lambda expressions to set the Behavior's options.


using DevExpress.Utils.Behaviors.Common;

behaviorManager1.Attach<OpenFolderBehavior>(buttonEdit1, behavior => {
    behavior.Properties.IconSize = FileIconSize.Small;
    behavior.Properties.InvalidPathImage = DevExpress.Images.ImageResourceCache.Default.GetImage("images/actions/close_16x16.png");
    behavior.Properties.ShowIcon = true;
});

Available Behaviors

The table below lists all the DevExpress Behaviors and the controls that support them.

Behavior Name

Description

Target Controls

FileIconBehavior

This Behavior adds a file/folder icon to a control if this control displays a path to an existing file or folder.

TextEdit

ButtonEdit

LabelControl

FilePathBehavior

Operates similarly to the FileIconBehavior, and additionally provides auto-complete hints.

TextEdit

ButtonEdit

OpenFileBehavior

OpenFolderBehavior

These Behaviors add ellipsis buttons to the ButtonEdit editor. Users can click these buttons to invoke file/folder browser dialogs. The editor displays an icon and a caption of the selected file/folder.

ButtonEdit

PersistenceBehavior

If you close and re-open a form with this Behavior attached, the form restores its last known position and size.

XtraForm

Ribbon Form

Tabbed Form

controls that implement the ISupportXtraSerializer interface

SnapWindowBehavior

Allows standard and DevExpress forms to snap to other windows and screen edges.

XtraForm

Ribbon Form

Tabbed Form

standard forms and their descendants

StubGlyphBehavior

Provides automatically generated icons for the target control or its child elements.

GridColumn

ImageComboBoxEdit

LayoutControlGroup

LayoutControlItem

XtraTabPage

TreeListColumn

ImageListBoxControl

ClockBehavior

Turns a control into a clock that displays the system's date and time.

LabelControl

BarStaticItem

DigitalGauge

KeyboardIndicatorBehavior

Indicates whether system keys (Caps Lock, Num Lock, Scroll Lock) are pressed.

LabelControl

BarStaticItem

BannerBehavior

This Behavior allows a Picture Edit to automatically cycle through a collection of images.

PictureEdit

DragAndDropBehavior

Allows users to drag-and-drop items between controls.

ListBoxControl

GridControl (GridView)

TreeList

Magnifier Behavior

Allows users to invoke the Magnifier tool and pick colors on their screen.

All ColorEdit descendants

Pager Navigation Behavior

Allows you use a RadioGroup or WindowsUIButtonPanel to browse the target control’s child items (tiles, slide images, etc.).

TileControl

TileBar

NavigationFrame

ImageSlider

Breadcrumb Behavior

Allows you to implement a breadcrumb navigation through a TreeList's hierarchy using a BreadCrumbEdit control.

TreeList, BreadCrumbEdit