Ticket T218619
Visible to All Users

ASPXGridListEditor - Group rows show plain text in version 14.2

created 10 years ago

Hi

I am upgrading a XAF application from 13.2 to 14.2.

I have a Grouped column in a listview where the grouped item is an returned as enum item. In 13.2 the attribute Imagename showed the image and dipslayname in the column name next to expand icon.

A line in the Enum:

<XafDisplayName("Not yet processed")> _
<ImageName("State_Validation_Skipped")> _
Unprocessed = 0
The corrected XAFDisplayname works but the image is no longer showing although works in 13.2?

Many thanks for looking into this for me.

Ken

Answers approved by DevExpress Support

created 10 years ago (modified 10 years ago)

Hello Ken,

Enums' images were shown in previous versions by custom group content templates. Starting from version 14.2, we are using data-specific column types instead of custom templates for performance reasons (see UI.Web - Links to referenced objects are not shown in grid columns in version 14.2). So, templates are not used for group rows. To enable the previous behavior, set the ASPxGridListEditor.EnableGroupTemplate property to true and tell XAF to create data item templates for enumeration properties by handling the ASPxGridListEditor.CreateCustomDataItemTemplate event, as shown below:

C#
public class ViewController1 : ViewController<ListView> { ASPxGridListEditor gridListEditor; protected override void OnActivated() { base.OnActivated(); gridListEditor = View.Editor as ASPxGridListEditor; if (gridListEditor != null) { gridListEditor.CreateCustomDataItemTemplate += gridListEditor_CreateCustomDataItemTemplate; gridListEditor.EnableGroupTemplate = true; } } void gridListEditor_CreateCustomDataItemTemplate(object sender, CreateCustomDataItemTemplateEventArgs e) { if (e.ModelColumn.ModelMember.Type.IsEnum) { e.CreateDefaultDataItemTemplate = true; } } protected override void OnDeactivated() { base.OnDeactivated(); if (gridListEditor != null) { gridListEditor.CreateCustomDataItemTemplate -= gridListEditor_CreateCustomDataItemTemplate; gridListEditor = null; } } }
    Comments (3)
    Anatol (DevExpress) 10 years ago

      May I make the ticket public to make it available for other customers?

        Hi Anatol,
        Thank you for the swift and correct answer - Another reason I'll be renewing be subscription shortly.
        Please go ahead and make this public if you consider it of interest to others. Here is the VB code I used:
        Public Class ViewController1
        Inherits ViewController(Of ListView)
        Private gridListEditor As ASPxGridListEditor
        Protected Overrides Sub OnActivated()
        MyBase.OnActivated()
        gridListEditor = TryCast(View.Editor, ASPxGridListEditor)
        If gridListEditor IsNot Nothing Then
        AddHandler gridListEditor.CreateCustomDataItemTemplate, AddressOf gridListEditor_CreateCustomDataItemTemplate
        gridListEditor.EnableGroupTemplate = True
        End If
        End Sub
        Private Sub gridListEditor_CreateCustomDataItemTemplate(sender As Object, e As CreateCustomDataItemTemplateEventArgs)
        If e.ModelColumn.ModelMember.Type.IsEnum Then
        e.CreateDefaultDataItemTemplate = True
        End If
        End Sub
        Protected Overrides Sub OnDeactivated()
        MyBase.OnDeactivated()
        If gridListEditor IsNot Nothing Then
        RemoveHandler gridListEditor.CreateCustomDataItemTemplate, AddressOf
        gridListEditor_CreateCustomDataItemTemplate
        gridListEditor = Nothing
        End If
        End Sub
        End Class
        Ken

        Anatol (DevExpress) 10 years ago

          You are welcome!

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.