Skip to content

ClausRogisch/XAF_how-to-represent-an-enumeration-property-via-a-drop-down-box-with-check-boxes-e689

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Files to look at:

How to represent an enumeration property via a drop-down box with check boxes

Scenario:

There is an enumeration type decorated with the FlagsAttribute, which means that an enumeration can be treated as a set of flags. There is also a property of this enumeration type inside the business class. This is helpful when several predefined enumeration values can be stored using this data property. In the UI, this data property is usually represented via an editor with multiple check boxes:


Steps To Implement:

Since there is no standard  PropertyEditor for enumerations that would allow you to store several values at once, it is common to implement custom Property Editors for this task. A custom PropertyEditor will take data property value as its input and represent it in the UI using a custom visual control. There will be one PropertyEditor for WinForms (based on the CheckedComboBoxEdit control from the XtraEditors Suite) and one for ASP.NET (based on the ASPxGridLookup control from our ASPxGridView and Editors Suite), because there is no platform-agnostic way to achieve such a look and feel.


Consider following the steps below to implement and use editors from this example in your project.
1. Implement an enumeration type decorated with the FlagsAttribute as shown in the E689.Module\BusinessObjects\DemoObjects.xx  file;
2. Copy the E689.Module.Win\Editors\EnumPropertyEditorEx.xx file into YourSolutionName.Module.Win project;
3. Copy the E689.Module.Web\Editors\ASPxEnumPropertyEditorEx.xx file into YourSolutionName.Module.Web project;
4. Build the solution and invoke the Model Editor for the ModelDesignedDiffs.xafml files from YourSolutionName.Module.Win and YourSolutionName.Module.Web projects.

5. Locate the BOModel | YourClassName | Members | YourEnumerationProperty node and set its PropertyEditorType property to the corresponding EnumPropertyEditorEx types.

 

See Also:

Implement Custom Property Editors
How to represent a enumeration property via radio buttons or check boxes on the Web


About

.NET, Frameworks (XAF & XPO), eXpressApp Framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 42.2%
  • Visual Basic .NET 40.0%
  • ASP.NET 17.8%