This example demonstrates how to store Report Gallery templates in a database and share them between multiple users.
Steps to implement a custom storage:
- Create a descendant of the abstract ReportGalleryExtension class.
- Set the ReportGalleryExtension.EnableSynchronization property to true to enable synchronization between a shared database storage and local Report Gallery instances. This also adds the Refresh button to Report Gallery toolbars. End users can click this button to update Gallery content explicitly.
- Implement the TryLoadGallery method to load the entire Report Gallery from the database storage.
- Implement the SaveGallery or SaveGalleryChanges method to save the entire Gallery or only the changes that have been made.
This example demonstrates how to implement the following storages:
-
XpoReportGalleryStorageSimple - saves and loads all the gallery items.
In this storage, the SaveGallery is implemented to overwrite the entire Report Gallery. The TryLoadGallery method is called when the Gallery runs and whenever a user manages gallery items.
-
XpoReportGalleryStorageAdvanced - saves and loads the changed items only.
In this storage, the SaveGalleryChanges method is implemented to save Report Gallery changes. The protected GetChanges method is overridden to compare changed items only. This method is called whenever a user manages gallery items. The TryLoadGallery method is called only when the Gallery runs.
Do the following to register the Report Gallery storage in your application:
-
WinForms
Call the static ReportGalleryExtension.RegisterExtensionGlobal method and pass the storage instance as the parameter. This registers the storage in the application globally.
-
WPF
Create a storage instance and assign it to the Report Designer's ReportGalleryOptions.Storage property.
- MainWindow.xaml.cs (VB: MainWindow.xaml.vb)
- MainWindow.xaml (VB: MainWindow.xaml)
- Form1.cs (VB: Form1.vb)
- XpoReportGalleryStorageAdvanced.cs (VB: XpoReportGalleryStorageAdvanced.vb)
- XpoReportGalleryStorageSimple.cs (VB: XpoReportGalleryStorageSimple.vb)
- XpoReportGalleryStorageBase.cs (VB: XpoReportGalleryStorageBase.vb)
- Report Gallery
- Implement a Custom Report Gallery Storage (WinForms)
- Implement a Custom Report Gallery Storage (WPF)
(you will be redirected to DevExpress.com to submit your response)