xaf-dashboards
XAF: Analytics & Dashboards Module
Setup
NuGet Packages
<!-- Core -->
<PackageReference Include="DevExpress.ExpressApp.Dashboards" Version="25.1.*" />
<!-- Blazor -->
<PackageReference Include="DevExpress.ExpressApp.Dashboards.Blazor" Version="25.1.*" />
<!-- WinForms -->
<PackageReference Include="DevExpress.ExpressApp.Dashboards.Win" Version="25.1.*" />
Blazor Program.cs
b.AddModule<DashboardsModule>();
b.AddModule<DashboardsBlazorModule>();
// Register dashboard services
builder.Services.AddDevExpressDashboards();
// In app configuration:
app.UseXaf();
app.MapControllers();
// DevExpress dashboard endpoint
app.MapDevExpressDashboardRoute("api/dashboard");
EF Core DbContext (add DashboardData table)
public class ApplicationDbContext : DbContext {
public DbSet<DashboardData> Dashboards { get; set; }
// ...
}
WinForms
Application.Modules.Add(new DashboardsModule());
Application.Modules.Add(new DashboardsWindowsFormsModule());
DashboardData — Persistent Storage
DashboardData is the built-in persistent object for storing dashboards in the database.
// Fields:
// Title (string) - display name in navigation
// Content (string) - dashboard layout as XML
// IsSynchronized (bool) - internal sync flag
Create a dashboard in code (predefined):
public class MyModule : ModuleBase {
public override void PopulateAdditionalExportedTypes(
string containerAssemblyName, List<Type> exportedTypes) {
base.PopulateAdditionalExportedTypes(containerAssemblyName, exportedTypes);
}
}
// Seed in Updater.cs
public override void UpdateDatabaseAfterUpdateSchema() {
base.UpdateDatabaseAfterUpdateSchema();
if (ObjectSpace.FindObject<DashboardData>(null) == null) {
var dashboard = ObjectSpace.CreateObject<DashboardData>();
dashboard.Title = "Sales Overview";
dashboard.Content = File.ReadAllText("SalesOverview.xml"); // exported .xml
ObjectSpace.CommitChanges();
}
}
Custom Dashboard Storage
public class MyDashboardStorage : IXafDashboardStorage {
private readonly IObjectSpaceFactory _factory;
public MyDashboardStorage(IObjectSpaceFactory factory) {
_factory = factory;
}
public IEnumerable<DashboardInfo> GetAvailableDashboardsInfo() {
using var os = _factory.CreateObjectSpace(typeof(DashboardData));
return os.GetObjects<DashboardData>()
.Select(d => new DashboardInfo { ID = d.ID.ToString(), Name = d.Title })
.ToList();
}
public XDocument LoadDashboard(string dashboardID) {
using var os = _factory.CreateObjectSpace(typeof(DashboardData));
var data = os.GetObjectByKey<DashboardData>(Guid.Parse(dashboardID));
return XDocument.Parse(data.Content);
}
public void SaveDashboard(string dashboardID, XDocument dashboard) {
using var os = _factory.CreateObjectSpace(typeof(DashboardData));
var data = os.GetObjectByKey<DashboardData>(Guid.Parse(dashboardID));
data.Content = dashboard.ToString();
os.CommitChanges();
}
public string AddDashboard(XDocument dashboard, string dashboardName) {
using var os = _factory.CreateObjectSpace(typeof(DashboardData));
var data = os.CreateObject<DashboardData>();
data.Title = dashboardName;
data.Content = dashboard.ToString();
os.CommitChanges();
return data.ID.ToString();
}
}
Data Sources in Dashboards
EF Core ObjectDataSource
// Register in DashboardsModule configuration
b.AddModule<DashboardsModule>(options => {
options.DashboardDataType = typeof(DashboardData);
});
// Make business objects available as dashboard data sources:
// The module auto-discovers XAF business objects via metadata
// No extra code needed — types registered in modules appear in designer
Custom Data Source Provider
public class MyDashboardDataProvider : DashboardDataProvider {
readonly IObjectSpaceFactory _factory;
public MyDashboardDataProvider(IObjectSpaceFactory factory) {
_factory = factory;
}
public override object GetDataSource(string dataSourceName, IDictionary<string, object> parameters) {
using var os = _factory.CreateObjectSpace(typeof(SalesData));
return os.GetObjects<SalesData>()
.Select(s => new { s.Date, s.Amount, s.Region })
.ToList();
}
}
// Register:
services.AddSingleton<DashboardDataProvider, MyDashboardDataProvider>();
Dashboard Viewer in UI
XAF automatically adds dashboards to the Navigation under a "Dashboards" group. Users open dashboards from the navigation item — no extra code needed.
Dashboard Designer
- Blazor: Integrated designer available in-browser when user has
Writepermission onDashboardData - WinForms: Native XtraDashboard Designer hosted within application
// Enable designer for all authenticated users:
role.AddTypePermission<DashboardData>(SecurityOperations.FullAccess, SecurityPermissionState.Allow);
// Viewers only (no design access):
role.AddTypePermission<DashboardData>(SecurityOperations.ReadOnlyAccess, SecurityPermissionState.Allow);
Security Permissions
| Permission | Capability |
|---|---|
Read DashboardData |
View dashboards |
Write DashboardData |
Edit dashboards in designer |
Create DashboardData |
Create new dashboards |
Delete DashboardData |
Delete dashboards |
Export / Print
Dashboard viewer provides built-in export toolbar:
- PDF export
- Excel/XLSX export
- Image export
No additional code needed — built into the viewer component.
v24.2 vs v25.1 Notes
| Feature | v24.2 | v25.1 |
|---|---|---|
| Blazor designer | Preview quality | Production stable |
| .NET target | .NET 8 | .NET 8 / .NET 9 |
| AI-assisted creation | Experimental | Enhanced |
Source Links
- Dashboards Module: https://docs.devexpress.com/eXpressAppFramework/117449/analytics
- XAF Dashboards: https://docs.devexpress.com/eXpressAppFramework/117449/analytics/dashboards
- DashboardData API: https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.Dashboards.DashboardData
- IXafDashboardStorage: https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.Dashboards.IXafDashboardStorage
- DevExpress Dashboard Docs: https://docs.devexpress.com/Dashboard/15960
More from kashiash/xaf-skills
xaf
DevExpress XAF (eXpressApp Framework) master index. Use this skill first when working with any XAF topic to find the right sub-skill. Covers Blazor and WinForms, EF Core and XPO, versions v24.2 and v25.1. Sub-skills: xaf-xpo-models, xaf-ef-models, xaf-controllers, xaf-editors, xaf-custom-editors, xaf-nonpersistent, xaf-security, xaf-multi-tenant, xaf-web-api, xaf-validation, xaf-reports, xaf-dashboards, xaf-office, xaf-blazor-ui, xaf-winforms-ui, xaf-conditional-appearance, xaf-deployment, xaf-memory-leaks.
13xaf-winforms-ui
XAF WinForms UI platform - WinApplication setup, Ribbon vs Standard toolbar, WinForms-specific editors (XtraGrid, DevExpress controls), Detail View layout customization via Layout Manager, custom WinForms controls embedded in XAF views, background workers for thread-safe UI updates, splash screen customization, WinForms navigation (NavigationFrame), printing/preview in WinForms, ClickOnce/MSI deployment. Use when building or customizing XAF WinForms applications.
10xaf-blazor-ui
XAF Blazor UI platform - BlazorApplication setup in Program.cs, AddXaf/AddXafBlazor services, InvokeAsync thread safety (critical for Blazor Server), async controller actions pattern, Blazor-specific editors, embedding custom Razor components as ViewItems using IComponentContentHolder, JavaScript interop via IJSRuntime, Detail View layout customization (tabs/groups), programmatic navigation, error handling with UserFriendlyException, SignalR configuration. Use when building or customizing XAF Blazor Server applications.
10xaf-office
XAF Office/Document Management Modules - FileAttachmentsModule with IFileData/FileAttachment patterns (XPO and EF Core), SpreadsheetModule for Excel editing with ISpreadsheetValueStorage, RichTextModule for Word-like editing with IRichTextDocumentProvider and mail merge, PdfViewerModule for PDF display, platform differences (Blazor vs WinForms), programmatic document manipulation. Use when adding file attachments, spreadsheet editing, rich text editing, or PDF viewing to DevExpress XAF applications.
9xaf-reports
XAF Reports Module (XtraReports v2) - ReportsModuleV2 setup for Blazor and WinForms, report storage (DB/filesystem/custom IReportStorageWebExtension), creating predefined reports in code (PredefinedReportsUpdater), data sources (CollectionDataSource/EntityServerModeSource), report parameters, programmatic export (PDF/Excel/Word), in-app designer, PrintAction, security permissions for report design vs view. Use when working with DevExpress XtraReports integration in XAF.
9xaf-editors
XAF built-in property editors and list editors - editor type mapping by data type, EditorAliases constants, [EditorAlias] attribute, [ModelDefault] for DisplayFormat/EditMask, ObjectPropertyEditor for inline sub-forms, list editor types (GridListEditor, DxGridListEditor, TreeListEditor, ChartListEditor), GridListEditor WinForms customization, DxGridListEditor Blazor customization, IModelListView/IModelColumn properties. Use when working with built-in XAF editors or customizing grid/list views.
8