Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                • To solve this problem, you can execute the following steps:
                                  1) Set the standard System.ComponentModel.DescriptionAttribute to the enum fields, whose caption you want to change.
                                  2) Implement a custom PropertyEditor, using the source code of the EnumPropertyEditor, used for displaying the enum type properties by default (\Program Files\Developer Express Inc\eXpressApp Framework v8.2\Sources\DevExpress.ExpressApp\DevExpress.ExpressApp.Win\Editors\EnumPropertyEditor.cs), and change the EnumImagesLoader class constructor, as shown in the following code:

                                  public EnumImagesLoader(Type enumType) {
                                      EnumDescriptor descriptor = new EnumDescriptor(enumType);
                                      imageCollection = new ImageCollection();
                                      comboboxItems = new List<ImageComboBoxItem>(descriptor.Values.Length);
                                      foreach (object value in descriptor.Values) {
                                          ImageInfo imageInfo = descriptor.GetImageInfo(value);
                                          int imageIndex = -1;
                                          if (!imageInfo.IsEmpty) {
                                              imageCollection.AddImage(imageInfo.Image);
                                              if (imageCollection.Images.Count == 1) {
                                                  imageCollection.ImageSize = imageInfo.Image.Size;
                                              }
                                              imageIndex = imageCollection.Images.Count - 1;
                                          }
                                          string caption = string.Empty;
                                          FieldInfo fInfo = enumType.GetField(value.ToString());
                                          foreach (Attribute attr in Attribute.GetCustomAttributes(fInfo)) {
                                              if (attr.GetType() == typeof(DescriptionAttribute)) {
                                                  caption = ((DescriptionAttribute)attr).Description;
                                              }
                                          }
                                          if (caption == "") {
                                              caption = fInfo.Name;
                                          }
                                          comboboxItems.Add(new ImageComboBoxItem(caption, GetEnumValue(value), imageIndex));
                                      }
                                  }
                                  
                                  3) Use a newly implemented PropertyEditor as a default for the enum type properties.
                                  For additional information, please refer to the following help topic: Implement Custom Property Editors.
                                  I've also attached my sample project.

                                  Thanks,
                                  Anatol

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Starting with version 12.2, use the XafDisplayName attribute to localize an enumeration value instead of the Description one supported in version 9.2.
                                See http://www.devexpress.com/Support/WhatsNew/DXperience/files/12.2.2.bc.xml#BC1737 for more details.

                                You must  log in  or  register  to leave comments

                                To start a chat you should create a support ticket


                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners