dashboard-17406-winforms-dashboard-winforms-viewer-manage-dashboard-layout.md
The Dashboard Viewer allows users to resize and maximize/restore dashboard items. You can also load and save the layout using the Dashboard API.
Tip
Open the dashboard in the Dashboard Designer to define the initial dashboard items layout before loading a dashboard into Dashboard Viewer.
Users can click and drag a separator line between items to resize them.
Users can expand any dashboard item into the entire dashboard size to examine data in greater detail.
To maximize a dashboard item, click the Maximize button in the dashboard item caption.
To restore the item size, click the Restore button.
In code, call the following methods:
DashboardViewer.MaximizeDashboardItemExpands the specified dashboard item to the entire dashboard size to examine data in greater detail.DashboardViewer.RestoreDashboardItemRestores the item size if an item is expanded to the entire dashboard size (maximized).
The control automatically stretches or shrinks content (dashboard items) in a dashboard to fit available screen space horizontally and vertically. You can adjust the layout options and specify exact content width and height.
The LayoutOptions property allows you to access the LayoutOptions object. You can use the Height and Width properties to adjust the dashboard layout. These properties return the LayoutDimensionOptions object that contains settings for the corresponding dimensions of the dashboard surface.
The LayoutDimensionOptions.Mode property allows you to specify whether a dashboard surface’s height or width is fixed or adjusted to fit its content:
AutoThe height or width of a dashboard surface fits to content.FixedThe height or width of a dashboard surface is set in pixels according to the LayoutDimensionOptions.Value property.
You can also mix layout modes for each dimension: for example, set the Auto value for width and Fixed for height to scroll dashboard layout vertically.
Use the following methods to save/load the dashboard layout to/from a stream or XML file.
DashboardViewer.SaveDashboardLayoutSaves a dashboard layout (layout items and layout containers) to a separate XML file.DashboardViewer.LoadDashboardLayoutLoads a dashboard layout from an XML file.
After the dashboard layout is changed, the DashboardViewer.LayoutChanged event occurs.