Skip to content

Latest commit

 

History

History
45 lines (29 loc) · 4.27 KB

File metadata and controls

45 lines (29 loc) · 4.27 KB

Dashboard for WPF - How to embed a DevExpress control in the WPF Dashboard

This example demonstrates how to embed a DevExpress Gantt Control in a dashboard loaded in WPF Viewer and bind the Gantt control to the dashboard's data. It uses a style selector to substitute a regular dashboard item with an arbitrary WPF control, and handles its SizeChanged event to provide it with data.

screenshot

The application displays a sample dashboard created in Visual Studio that contains the Grid dashboard item bound to Gantt-specific data (data fields contain hierarchical tasks, start and end values).

The main application's window contains the Gantt control placed in the ganttStyle style included in XAML as a resource. The Gantt control is bound to the window's data context. The GanttControl's ItemsSource property is bound to the GanttTasks View Model's property declared in a POCO View Model.

The main application's window uses the DashboardControl.GridItemStyleSelector property to assign the ganttStyle style as the Grid dashboard item's content. The Gantt control is rendered and displayed instead of the GridDashboardItem.

The Gantt control's SizeChanged event is handled to provide data to the control. The handler code waits until the data is loaded and calls the DashboardControl.GetItemData method to obtain the MultiDimensionalData object that contains the embedded control's data. The ConfigureGanttTasks method converts data to the ObservableCollection<GanttTask> type. The resultant collection is assigned to the GanttTasks View Model's property.

This approach is not limited to DevExpress data-bound controls and can be used to embed any WPF control in a dashboard.

Files to Review

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)