posted 1 year ago
Hi.
I have a Listview with its items from a ObservableList<CustomItem>.
The cell factory is made with a CustomControl based on an AnchorPane, and displays multiple labels. Those labels's textProperty are bind to the properties of CustomItem class.
My problem is that because of the height of the CustomControl (the cell of the listview) is sometimes displayed partially in the listview. When I click on such an item, which is not entirely in the view, I want to scroll the listview as the cell to be entirely in the listview. But the scrollTo() method will scroll the listview as the selected item will be in the top of the list. I want only to bring it into view, not scrolling it to the top of the list. So, if my control is in the bottom of the listview and supposing its height is 80px and it is only 20% in the view of the listview, to be able to scroll the listview to see the rest of the 80%, and to be align to the bottom of the listview. If it is in the top, and partially outside of the listview viewport to align to the top of the listview. And if it is inside listview, and I see it entirely, to do nothing.
I think I have to calculate the position of the cell in the listview viewport.
Or someone, do you know a library which have this ability?
Sorry for my english 😁