Reputation: 4999
I am designing a RDLC report in WPF. Naturally I am using WindowsFormsHost to host a ReportViewer object to display the report. However, since the length of the report, specifically, the height, of the report varies each time the report is calculated and rendered depending on the actual content of the report, I want the control can adjust the size of the ReportViewer object. How can I do that? Currently I set the height of WindowsForsHost object as Auto. But that only takes effect at the first time when the WPF page is loaded, when no report is actually displayed(We need the user to input some parameters for the report and then click to calculate the report). And whenever the new report is displayed, the size of the object is not changed any more. Thanks!
Upvotes: 3
Views: 1094
Reputation: 77
I'm not sure I got your Problem right. Maybe this helps:
You can bind the Width
and Height
of a control to the width and height of an other control.
For Example by defining the type of the first parent element that has the right width, here a grid:
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType=Grid}, Path=ActualWidth"}
or by the name of the element:
Width="{Binding ElementName=MyElement, Path=ActualWidth}"
ActualWidth
is the current width of the element, if the width of MyElement changes, the width of the bound element changes too. Same for the Height
property.
Upvotes: 1