开发者

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 make Window.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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜