如何使扩展器扩展到网格行
我一直在寻找这个问题的答案,但我找到的所有解决方案都无法正常工作。
问题就在这里。我有基于网格的界面,如下所示:
| __________________________________|
|(v)expander |(v)expander |(v)expander | <- grid inside the row of main grid
|___________________________________|
| |
| |
| |
. . <- grid, stackpanel, etc. inside row
. .
. .
| |
|___________________________________|
|(^)expander | (^) expander | | <- grid inside the row of main grid
|___________________________________|
每个扩展器都放置在它自己的边界上。
现在我希望扩展器能够扩展到接口的其余部分。顶部扩展器向下扩展,底部扩展器向上扩展。我无法使用 RowSpan。我想应该用 zIndex 来完成,但我尝试了很多次但没有成功。我将所有网格和边框Panel.ZIndex属性设置为99,并且扩展器的内容设置在ZIndex上大约999。
有什么办法可以做到吗?
谢谢,
乔
I was looking for the answer of this, but all solutions I've found was not working properly.
Here is the problem. I have interface,based on grid like the below:
| __________________________________|
|(v)expander |(v)expander |(v)expander | <- grid inside the row of main grid
|___________________________________|
| |
| |
| |
. . <- grid, stackpanel, etc. inside row
. .
. .
| |
|___________________________________|
|(^)expander | (^) expander | | <- grid inside the row of main grid
|___________________________________|
Each expander is placed on it's own border.
Now I want expanders to expand over the rest of interface. Top expanders expand down, bottom ones - up. I can't use RowSpan. It should be done with zIndex somehow I guess, but I was trying with that in a lot and didn't work. I set all grids and borders Panel.ZIndex property to let's say 99, and the content of expander was set on ZIndex about 999.
Is there any way to do it?
Thanks,
Joe
一段时间后(当我一直在做其他事情来刷新我对这个主题的想法时)我找到了解决方案。它基于 Karl Shifflet 解决方案 ( http://karlshifflett.wordpress.com/2008/02/05/wpf-sample-series-expander-control-with-popup-content/)。
我将容纳顶部扩展器的网格放置在画布上。我将 Canvas
Panel.ZIndex
属性设置为大约 99,并将背景设置为所需的颜色。Grid.Background
属性设置为透明和Width
以填充画布大小:重要的是将所有扩展器
VerticalAlignment
设置为顶部,因为当其中一个扩展器展开,网格高度(在这种情况下不应硬定义)也会调整大小,并且当它们的垂直对齐方式未设置为顶部时,所有扩展器都放置在中间。我希望它能帮助某人。
After a while (when I have been doing sth else to refresh my mind on this topic) I found the solution. It is based on Karl Shifflet solution ( http://karlshifflett.wordpress.com/2008/02/05/wpf-sample-series-expander-control-with-popup-content/ ).
I placed the Grid that holds top expanders onto the Canvas. I set the Canvas
Panel.ZIndex
property to about 99 and set the Background to desired colour. TheGrid.Background
property was set to Transparent andWidth
to fill canvas size:Important thing was to set all expanders
VerticalAlignment
to Top, because when one of them expands, the Grid Height (which should not be hard defined in this case) also resizes, and when Vertical Alignment of them is not set to Top, all expanders are placed in the middle.I hope it helps someone.