Hi
When i generate a preview for my datagrid the initial position is not on the top left. Somehow there's a margin?
Hello,
By default one page is displayed, centered in the preview. You can change the width of the page to fit in the viewer by adding the following to your code:
this.XamReportPreview1.GeneratePreview(report, false, false);
this.XamReportPreview1.ApplyTemplate();
this.XamReportPreview1.DocumentViewer.FitToWidth();
Valerie
Thanks for the reply but it didn't work.
Here's the results of my test using the code I suggested. Is that what are you seeing?
Did the sample provide what you were looking for?
Please see the attached sample which renders the report.
Let me know if this resolves your issue.
Thanks,
Unfortunately the proposed solution didn't work. Here's the style and code:
<Style x:Key="PagePresenterStyle" TargetType="{x:Type igReporting:ReportPagePresenter}"> <Setter Property="HorizontalContentAlignment" Value="Left"/> <Setter Property="VerticalContentAlignment" Value="Top"/> </Style>
Report report = new Report(); //report.PagePresenterStyle = this.TryFindResource("PagePresenterStyle") as Style; EmbeddedVisualReportSection section = new EmbeddedVisualReportSection(idg1); section.PagePresenterStyle = this.TryFindResource("PagePresenterStyle") as Style; report.Sections.Add(section); this.XamReportPreview1.GeneratePreview(report, false, false);
Were you able to resolve this issue?
To remove the margins in the document. You can create a style for the ReportPagePresenter with two setters for Horizontal/VerticalContentAlignment and set those properties to left/top. Then on the Report (or EmbeddedVisualReportSection) you can set the PagePresenterStyle property to the style you created.