private void chkSelectAll_Click(object sender, RoutedEventArgs e) { if (chkSelectAll.IsChecked.Value == true) { SynopticGrid.SelectAll(); } else { SynopticGrid.UnselectAll(); } }
private void ExportToExcel() { SynopticGrid.SelectAllCells(); SynopticGrid.ClipboardCopyMode = DataGridClipboardCopyMode.IncludeHeader; ApplicationCommands.Copy.Execute(null, SynopticGrid); String resultat = (string)Clipboard.GetData(DataFormats.CommaSeparatedValue); String result = (string)Clipboard.GetData(DataFormats.Text); SynopticGrid.UnselectAllCells(); System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Wimea\synoptic.xls"); file.WriteLine(result.Replace(',', ' ')); file.Close(); MessageBox.Show(" Exporting DataGrid data to Excel file created"); }