0

I have a grid layout that splits a view into two parts, effectively for two sets of headings and list. I want each list to share the height of the active view evenly so I've used proportional sizing:

In the case where both lists exceed the height available this works just fine. However, if the top list only has 1 or two items, it sizes nicely to the space it needs, however the second list does not use all of the remaining space, it only uses 50% of the original screen size when I'd like it to use whatever's left if the first list doesn't need half.

I could use a Dock Panel and let the last row fill, but in cases where the first list is large I want it limitted proportionally, not a fixed max height.

Does anyone know if the grid supports this, or if there is some combination to acheive this that will work with scrolling if the available size is not sufficient for both lists, ensuring the lists share available space evenly?

4

2 回答 2

0

如果我对您的理解正确,那么我想不出一种方法来使用 WPF 的像素/比例/星形/自动调整大小选项做出大小决定......

但也许您可以通过获取 ActualHeight/ActualWidth 属性,然后根据您想要的比例计算您的 MaxHeight/MaxWidth/Height/Width 来使其在代码隐藏中工作。

于 2010-06-23T03:16:41.620 回答
0

您可以通过覆盖 MeasureOverride 方法来做到这一点。看看这里:

http://alecbryte.com/post/2009/01/16/WPF-Proportional-Panel.aspx

于 2011-02-18T01:51:36.127 回答