How to make Window Height adjust to content?
I have simple Window.
In this Window I have Grid with few Rows which height I am setting dynamicly. Now I want to makeWindow.Height = sum of Grids Rows.
What a problem seems to be is that Grid itself is filling whole Window (it is ok) but in this grid there is empty space beside area occupied by rows.
What should I do?
For example I ha开发者_开发百科ve rows witch height= 100 and 200 and whole grid have height 500 but should have 300.
<Window
...
SizeToContent="WidthAndHeight">
<Grid>
...
</Grid>
</Window>
SizeToContent is the property that you want to set. I use this all of the time, it is great.
Set Window.SizeToContent property to WidthAndHeight.
精彩评论