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:
-
Model Editor. Localize the Caption property value of a required class member under the BOModel | ModelClass | ModelMember node in the Model Editor (Recommended).
-
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
-
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.
-
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.