class MainView : Fragment("My View") { val expandedState: ExpandedStateHolder by inject() override val root = listview(listOf(Category("A"), Category("B")).observable()) { cellCache { titledpane(it.name) { listview(it.components) { prefHeight = 200.0 cellCache { stackpane { this += ComponentView(it.name) } } } val expandedState = expandedState.categoryExpanded(it.name) isExpanded = expandedState.value expandedState.cleanBind(expandedProperty()) } } } }