When i print or print preview using Reporting from my XamDataGrid, i the first page is rendered abnormally small, if I have a column GroupedBy. It only appears to take up about half of the page width. The rest of the pages are fine. What is the problem? It only happens when there is GroupBy field, and only if i set
report.ReportSettings.HorizontalPaginationMode = HorizontalPaginationMode.Scale;
Included some of my code:
public PrintPreview(XamDataGrid grid, bool isLandscape, string title) { InitializeComponent(); this.DataContext = this; if (Application.Current.MainWindow.IsLoaded) { this.Owner = Application.Current.MainWindow; } AddCommands(); Grid = grid; Grid.AutoFit = true; EmbeddedVisualReportSection selection = new EmbeddedVisualReportSection(Grid); if (isLandscape) { report.ReportSettings.PageOrientation = PageOrientation.Landscape; } else { report.ReportSettings.PageOrientation = PageOrientation.Portrait; } //scale to fit all columns on the page? default spreads across pages mosaic etc. -- Scale seems to make first page small if there is a groupby report.ReportSettings.HorizontalPaginationMode = HorizontalPaginationMode.Scale; //make column headers repeat every page report.ReportSettings.RepeatType = RepeatType.LevelBreak; //PageBreak? //Add title if exists if (!String.IsNullOrEmpty(title)) { report.PageHeaderTemplate = Application.Current.TryFindResource("PagePresenterHeaderTemplate") as DataTemplate; //in Resources.ExplicitStylesResourceDictionary report.PageHeader = title; } //Add page numbering report.PageFooterTemplate = Application.Current.TryFindResource("PagePresenterFooterTemplate") as DataTemplate; report.Sections.Add(selection); ReportProgressControl progressInfo = new ReportProgressControl(); progressInfo.Report = report; xamReportPreview1.GeneratePreview(report, true, true); }
private XamDataGrid Grid { get; set; } private Report report = new Report(); private bool IsLandscape { get; set; }
Hello Travis,
We have shipped out a new service release where your issue is resolved. I'd be glad to find out if you had tested it out and if it had met your requirements.
You can download the Service Releases by logging to our web site and going to Account\My Keys and Downloads.
I have logged this behavior with our developers in our tracking system, with an issue ID of 188129. I have also created a support ticket on your behalf with number CAS-150470-D6S7L4 in order to link the development issue to it so that you are automatically updated when a Service Release containing your fix is available for download.
whoops that should have been
this.XamDataGrid1.FieldLayoutSettings.AutoFitMode = AutoFitMode.Never;
Certainly appears to be AutoFitMode=Always causing the issue. If i resize Column 0 before clicking the Genereate Preview button, everything seems to render properly in the Preview! I suppose resizing makes AutoFitMode to something other than Always?
Adding:
this.XamDataGrid1.FieldLayoutSettings.AutoFitMode = AutoFitMode.Default;
to the Genereate Preview code also seems to fix the issue.
What is the best way to set this up, since the user may or may not resize columns and then would expect the printing to behave as the on screen grid does? I have some grids that may contain many columns, 15 or more. I also have code that doesn't print the sigma (filter) part of the labels and i also hide the row selector column when printed. Thanks!
I was FINALLY able to modify your sample to reproduce the issue. Apparently it is something in the XamDataGrid's FieldSettings or FieldLayoutSettings causing the problem. Modified sample attached...