How to: Preview XtraGrid Control

The following example shows how to preview XtraGrid.


private void ShowGridPreview(DevExpress.XtraGrid.GridControl grid) {
   // Check whether the Grid Control can be previewed.
   if(!grid.IsPrintingAvailable) {
      MessageBox.Show("The 'DevExpress.XtraPrinting' Library is not found", "Error");
      return;
   }
   // Opens the Preview window.
   grid.ShowPreview();
}

The image below shows a Preview window for a sample grid.

CD_XtraGridPrinting