Take the 2-minute tour ×

I have a custom drawn control containing some plots. I've put it inside a scrollviewer since later I want to be able to zoom the control's contents. I want this control to have a specific minimum height and if the available visible space is bigger than that it should fill the space. However using MeasureOverride I just get infinity for the available height (because of the scrollviewer). How can I get the actual available visible space during MeasureOverride to stretch my control to this height?

share|improve this question
add comment

1 Answer

You should not need to do any layout overriding for that, just set the alignments to Stretch and a MinHeight.

share|improve this answer
You are right, this works. Thanks :) However now I have the next problem: I draw all the plots manually for performance reasons. I also do the zooming that way and I'd like the panel to grow in height according to the zoom level (scrolling inclusive). How can I achieve that? (The control's height is set to NaN, just tried that) –  Tobias Zimmermann Aug 31 '12 at 14:23
@TobiasZimmermann: Use the LayoutTrasform, set it to a ScaleTransform. –  H.B. Aug 31 '12 at 14:27
unfortunately this doesn't work well thanks to me drawing my plots "by hand" (it looks terrible then) –  Tobias Zimmermann Sep 3 '12 at 7:08
@TobiasZimmermann: Well, that would have been the standard way, can't you change the size and simultaneously change the scale at which you draw? –  H.B. Sep 5 '12 at 1:43
add comment

Your Answer


