是否可以获取自定义ItemRenderer来滚动DataGrid而不是其单元格?

时间:2022-05-09 14:23:43

I'm having an issue with a custom ItemRenderer I've written for a DataGrid. With this ItemRenderer, it's possible that the contents could exceed the width and height of the DataGrid cell - and when this happens, scroll bars appear, letting me scroll the individual cell.

我遇到了一个我为DataGrid编写的自定义ItemRenderer的问题。使用此ItemRenderer,内容可能会超出DataGrid单元格的宽度和高度 - 当发生这种情况时,会出现滚动条,让我滚动单个单元格。

What I would like, however, is that when the contents of the cell are too large, the entire DataGrid scrolls, rather than the individual cells.

然而,我想要的是,当单元格的内容太大时,整个DataGrid会滚动,而不是单个单元格。

Now, when I set the custom ItemRenderer's horizontal and vertical scroll bar policies to "off", I get the vertical scrolling on the DataGrid that I want (the individual cells stretch to accommodate the full height of the contents) but I don't get any horizontal scrolling. Instead, any content too wide for the cell is clipped. Incidentally, setting the DataGrid's horizontal scroll bar policy to "on" has no effect, the scroll bar gutter is drawn, but nothing scrolls

现在,当我将自定义ItemRenderer的水平和垂直滚动条策略设置为“off”时,我得到了我想要的DataGrid上的垂直滚动(单个单元格伸展以容纳内容的完整高度)但是我没有得到任何水平滚动。相反,任何对于单元格来说太宽的内容都会被剪裁。顺便说一句,将DataGrid的水平滚动条策略设置为“on”无效,滚动条装订线被绘制,但没有任何滚动

Is there a way to force the DataGrid to scroll horizontally when my custom ItemRenderer's contents are too wide for the cell?

当我的自定义ItemRenderer的内容对于单元格来说太宽时,有没有办法强制DataGrid水平滚动?

1 个解决方案

#1


0  

You may have to find a way calculate and expand the size of the DataGrid horizontally in a canvas so that it shows all the cells, and the scrollbar would appear as part of the canvas.

您可能必须找到一种方法在画布中水平计算和扩展DataGrid的大小,以便它显示所有单元格,并且滚动条将显示为画布的一部分。

#1


0  

You may have to find a way calculate and expand the size of the DataGrid horizontally in a canvas so that it shows all the cells, and the scrollbar would appear as part of the canvas.

您可能必须找到一种方法在画布中水平计算和扩展DataGrid的大小,以便它显示所有单元格,并且滚动条将显示为画布的一部分。