From 1c43aeb4cf2b7d1ee69b1c763384761858f71068 Mon Sep 17 00:00:00 2001 From: Sreemon Premkumar M Date: Mon, 25 Aug 2025 11:48:18 +0530 Subject: [PATCH] ES-975464 - Resolve the ReadMe issue in this sample repository --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 867b3db..721ac3c 100644 --- a/README.md +++ b/README.md @@ -1 +1,20 @@ -# how-to-disable-print-preview-in-uwp-datagrid \ No newline at end of file +# How to disable print preview in UWP DataGrid + +This sample illustrates how to disable the print preview in [UWP DataGrid](https://www.syncfusion.com/uwp-ui-controls/datagrid) (SfDataGrid). + +`SfDataGrid` provides support to print the data displayed in the `DataGrid` using [SfDataGrid.Print](https://help.syncfusion.com/cr/uwp/Syncfusion.UI.Xaml.Grid.SfDataGrid.html#Syncfusion_UI_Xaml_Grid_SfDataGrid_Print) method. + +You can disable the print preview in print dialog by setting [PrintTask.IsPreviewEnabled](https://docs.microsoft.com/en-us/uwp/api/windows.graphics.printing.printtask.ispreviewenabled?view=winrt-19041) property to `false`. + +``` csharp +this.dataGrid.PrintTaskRequested += DataGrid_PrintTaskRequested; + +private void DataGrid_PrintTaskRequested(object sender, DataGridPrintTaskRequestedEventArgs e) +{ + e.PrintTask = e.Request.CreatePrintTask("Printing", sourceRequested => + { + sourceRequested.SetSource(e.PrintDocumentSource); + }); + e.PrintTask.IsPreviewEnabled = false; +} +``` \ No newline at end of file