Tuesday, March 29, 2016
How to change the default error icons for failed validation rules
I've just updated the corresponding Support Center ticket and want to share one more advanced example on using the built-in ImageLoader API with you. Before reading further, please learn more on this helper class from its docs or from my previous post on the same subject:
How to load an icon for an XAF UI element from the database instead of using predefined images from assembly resources or file system.
In the latest XAF v15.2+, there is a universal and platform-agnostic way to replace the default validation images globally in the application by handling the static DevExpress.ExpressApp.Utils > ImageLoader >CustomGetImageInfo event. Consider the following example code that can be added in YourSolutionName.Module/Module.cs file:
This simple code will work in both ASP.NET and WinForms apps.
Even thought there is a built-in image used in the example, you can usually replace it with any other image. Refer to the event's documentation for a more complex use-case scenario where the image is obtained from the database.