Skip to main content
A newer version of this page is available. .

EnumItemsSourceBehavior Class

Binds a control’s ItemsSource property to an enumeration.

Namespace: DevExpress.Mvvm.UI

Assembly: DevExpress.Xpf.Core.v21.2.dll

NuGet Package: DevExpress.Wpf.Core

Declaration

[TargetType(typeof(ListBoxEdit))]
[TargetType(typeof(ItemsControl))]
[TargetType(typeof(LookUpEditBase))]
public class EnumItemsSourceBehavior :
    Behavior<FrameworkElement>

Remarks

You can use any of the following attributes with enumeration members:

The following code sample assigns the UserRole enumeration to the ComboBoxEdit‘s ItemsSource property:

<UserControl ...
    xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
    xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors">
    <Grid>
        <dxe:ComboBoxEdit>
            <dxmvvm:Interaction.Behaviors>
                <dxmvvm:EnumItemsSourceBehavior EnumType="{x:Type common:UserRole}"/>
            </dxmvvm:Interaction.Behaviors>
        </dxe:ComboBoxEdit>
    </Grid>
</UserControl>
public enum UserRole {
    [Image("pack://application:,,,/Images/Admin.png"), Display(Name = "Admin", Description = "High level of access", Order = 1)]
    Administrator,
    [Image("pack://application:,,,/Images/Moderator.png"), Display(Name = "Moderator", Description = "Average level of access", Order = 2)]
    Moderator,
    [Image("pack://application:,,,/Images/User.png"), Display(Name = "User", Description = "Low level of access", Order = 3)]
    User
}

EnumBehDefaultApperance

View Example

The following code snippets (auto-collected from DevExpress Examples) contain references to the EnumItemsSourceBehavior class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

Inheritance

Object
DispatcherObject
DependencyObject
Freezable
Animatable
DevExpress.Mvvm.UI.Interactivity.AttachableObjectBase
DevExpress.Mvvm.UI.Interactivity.Behavior
DevExpress.Mvvm.UI.Interactivity.Behavior<FrameworkElement>
EnumItemsSourceBehavior
See Also