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?
Hi Valerie
Yes. It can be seen that there's top and left spacing created.
This is the closest to top left that I can place the preview. I can create a feature request for you if you have other requirements. Please clarify exactly what you need. For example, I do not see any top spacing so an illustrated example of what you are looking for would be helpful.
Thanks,
In the above image the top and left spacing can be seen obviously. Unlike the result when printing, it has none.
As for feature request, i would appreciate if you can create one for 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.
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.
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?