Back to Devexpress

Banner Behavior

windowsforms-117311-common-features-behaviors-banner-behavior.md

latest2.2 KB
Original Source

Banner Behavior

  • Oct 29, 2020

The Banner Behavior turns a PictureEdit editor into a simplified Image Slider that loops through a collection of images.

The behavior stores banner images that replace the original editor image after a certain delay.

Supported controls

Behavior options

  • Images - a collection of banner images. The behavior iterates through this collection and assigns images to the target editor’s PictureEdit.Image property.
  • Interval - an amount of time (in milliseconds) it takes the editor to switch between images.
  • StartImmediatelly - a boolean property that specifies whether or not the editor should start displaying behavior images right away. If this property is disabled, the editor will start with its own original image.

Code sample

csharp
using DevExpress.Utils.Behaviors.Common;

behaviorManager1.Attach<BannerBehavior>(pictureEdit1, behavior => {
    behavior.Properties.StartImmediately = false;
    behavior.Properties.Interval = 3000;
    behavior.Properties.Images = new System.Drawing.Image[] {
        ((System.Drawing.Image)(global::Behaviors.Properties.Resources.SpecialOffer_Image1)),
        ((System.Drawing.Image)(global::Behaviors.Properties.Resources.SpecialOffer_Image2))
    };
});
vb
Imports DevExpress.Utils.Behaviors.Common

Private behaviorManager1.Attach(Of BannerBehavior)(pictureEdit1, Sub(behavior)
    behavior.Properties.StartImmediately = False
    behavior.Properties.Interval = 3000
    behavior.Properties.Images = New System.Drawing.Image() { 
        (CType(Global.Behaviors.Properties.Resources.SpecialOffer_Image1, System.Drawing.Image)),
        (CType(Global.Behaviors.Properties.Resources.SpecialOffer_Image2, System.Drawing.Image)) }
End Sub)