网格"脱钩"滚动(又名"冷冻"行和列) [英] Grid with "decoupled" scrolling (aka "frozen" rows and columns)
问题描述
下面是大致而言,我想什么来实现的:
绿色的部分是固定的。
橙色单元格(或粉红色?)部分是可编辑的。照片
在蓝色部分的细胞都还可以。
该 [添加冰箱]
按钮,添加另一列。
现在棘手的部分:
蓝色+绿色部分应该在一起,可滚动垂直。
蓝色+橙色部分应一起,被滚动的水平。
(暗红色一样的东西重新present滚动条)
可以看到这背后的逻辑是:我必须能够编辑产品数量为冰箱和产品的任何(合理的)数量,即使他们并不都适合在屏幕上。但我决不滚动无论是冰箱名称或产品名称淡出人们的视线。
我想完成这个布局只在XAML,绑定的(一个的ObservableCollection<冰箱和GT;
立即跳转到记)。编写自定义的转换器也是可以接受的。主要的一点是要避免创建/管理编程UI元素。
这是我的previous的想法和实验,有几个方面的考虑:
-
不能使用
电网
,因为它不能自动生成的顺序列 -
一系列嵌套的
李>的ItemsControl
取值可以工作,但后来我遇到了来自不同序列调整项目(即蓝色细胞,即橙色或绿色的问题 - 这取决于对嵌套的方向) - 见我的等问题 -
加分调整冰箱列。到目前为止,我只设法找到
GridSplitter
,但它仅适用于网格。
回答我的问题,这样我可以接受它:这就是所谓的冻结列和冻结行也没有,有注意开箱对于行情况。
Here is, roughly, what I'm trying to achieve:
The green part is fixed.
Cells in the orange (or pink?) part are editable.
Cells in the blue part are also editable.
The [add fridge]
button adds another column.
Now the tricky part:
The blue+green parts should, together, be scrollable vertically.
The blue+orange parts should, together, be scrollable horizontally.
(the dark red thingies represent scrollbars)
One can see the logic behind this: I must be able to edit product quantities for any (reasonable) number of fridges and products, even if they don't all fit on the screen. But I must never scroll either fridge names or product names out of sight.
I would like to accomplish this layout solely in XAML, with bindings (an ObservableCollection<Fridge>
immediately jumps to mind). Writing custom converters also would be acceptable. The main point is to avoid creating/managing UI elements programmatically.
A few considerations from my previous thoughts and experiments:
Can't use
Grid
, since it can't autogenerate columns from sequenceA series of nested
ItemsControl
s could work, but then I run into the problem of aligning items from different sequences (i.e. blue cells with either orange or green ones - depending on the direction of nesting) - see my other question.Bonus points for resizing the fridge columns. So far I've only managed to find
GridSplitter
, but it only works with grid.
Answering my own question just so I can accept it: this is called "frozen columns" and "frozen rows" and no, there is noting out of the box for the rows case.
这篇关于网格&QUOT;脱钩&QUOT;滚动(又名&QUOT;冷冻&QUOT;行和列)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!