EnumItemsSourceBehavior Class
Binds a control’s ItemsSource property to an enumeration.
Namespace: DevExpress.Mvvm.UI
Assembly: DevExpress.Xpf.Core.v21.2.dll
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
}
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