Ticket S36856
Visible to All Users

PivotGrid and Chart modules - How to localize field captions and other texts via the wizard

created 14 years ago (modified 2 years ago)

Localizing field captions

By default, the pivot grid and chart controls in XAF List Editors take captions for their fields from respective class members defined in the Application Model. Thus, captions for fields specified in the wizard at both runtime or design-time are ignored - they are overridden by the values taken from the Application Model. Custom or unbound fields in the pivot grid control are not overridden by the XAF code as well.

To localize pivot grid fields, consider one of the following solutions:

  1. Model Editor. Localize the Caption property value of a required class member under the BOModel | ModelClass | ModelMember node in the Model Editor (Recommended).

  2. Unbound Fields in the pivot grid wizard. Remove all standard bound fields and instead add new custom or unbound fields with the following characteristics set in the property grid:

  • Caption = AnyCaptionYouLike
  • FieldName= AnyUniqueFieldName
         - UnboundExpression = BoundFieldNameOrAnyValidExpression
         - UnboundType = CorrespondingBoundFieldOrExpressionResultType
  1. Customize the pivot grid in code. Implement a ViewController that will access a required ListEditor directly and customize its underlying pivot grid or chart controls every time they are shown in the UI. The idea is to use control-specific solutions to implement this task exactly as you would do in a regular non-XAF application. For more information on this, refer to the Access Grid Control Properties and List Editors help articles as well as the documentation on the DevExpress PivotGrid and Chart controls. If you have questions on these control-specific solutions, please create tickets for the corresponding control/product in the Support Center so we can assist you further.

  2. Override field caption at the ListEditor level. The PivotGridListEditor and ASPxPivotGridListEditor classes provide the virtual SetupPivotGridFieldCaption method allowing you to redefine field captions. See an example in the ASPXPivot Set caption ticket.

NOTE: While options #2-4 for localizing field captions are technically possible, they look redundant, because they mean duplicating work for an XAF developer. The Application Model is the default and recommended place to localize almost everything in an XAF application, including but not limited to, list and detail forms, reports, etc. - there you perform a localization of a field caption once and this localized value is used everywhere for the most standard XAF modules. The use of wizards and Controllers is only justified in rare cases when captions are not exposed in the Application Model by default. If you still need to have the capability to localize field captions via the control wizard in an XAF app, please let us know in comments why you need to duplicate this work, because we may be missing some helpful scenarios. Thanks.

Localizing values of enumeration fields

Refer to the Localization - Use localized enumeration values from the Application Model for every visual control integrated in XAF ticket for more details.

Localizing custom control-specific texts unrelated to data fields (like chart titles and legend)

Refer to the Localization - Make it possible to have chart and pivot grid settings based on a specified culture ticket for more details.

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.