I had such a problem when I indicated the width of my window, but had a height equal to Auto
. The DockPanel
child set its VerticalAlignment
to "Top", and the window was set to "Vertical match" for the Version, but the Window will still be much higher than the contents.
Using Snoop, I found that the ContentPresenter
inside the Window (part of the window, and not what I put there) has a VerticalAlignment
set to Stretch
and cannot be changed without having to re-view the entire window
After many disappointments, I discovered the SizeToContent
property - you can use this to indicate whether you want the Window to be sized vertically, horizontally or both, depending on the size of the content - now everything looks beautiful, I just can't believe it that it took me so long to find this property!
TabbyCool Feb 23 '10 at 12:07 2010-02-23 12:07
source share