Binding two tableviews together such that they scroll in sync

前端 未结 3 1222
甜味超标
甜味超标 2021-02-10 06:38

I want to bind two tableviews together such that they scroll in sync. How do I do that? I am unable to find out how to access the scrollbar of a tableview.

3条回答
  •  自闭症患者
    2021-02-10 07:21

    I don't think this is currently possible. TableViewSkin inherits from VirtualContainerBase which has a VirtualFlow field. The VirtualFlow object has two VirtualScrollBar fields, hbar and vbar which is what you're after. I can't see any way of getting to it though.

    Interestingly, there is also a private contentWidth field in TableView although this is private. I'm sure that the JFX team are being ultra cautious about opening up too much of the API which is understandable. You could ask to get the contentWidth field opened up as an int property as a feature requestion on the JFX JIRA or openjfx-dev mailing list.

    A stop gap measure would be to bind the selected item or index property of the table views selection model.

提交回复
热议问题