### Clear Selection

Example of clearing the ListView selection by using JavaFX API methods (requires the JavaObjecvt Library).
'Clear the listview selection by using a JavaObject
'Note that the Index of the Event ListView1_SelectedIndexChanged is -1.
`Sub ClearSelection(lv As ListView)
Dim jo As JavaObject = lv
jo.RunMethodJO("getSelectionModel", Null).RunMethod("clearSelection", Null)
End Sub`
Example Button to clear the selections in the ListView
`Sub btnClearSelection_Action
ClearSelection(ListView1 )
Log("ListView Selection cleared")
End Sub`
'Handle Listview selection change
`Sub ListView1_SelectedIndexChanged(Index As Int)
Log("ListView1_SelectedIndexChanged. Index = " & Index)
'Check if an item is selected
If Index = -1 Then Exit
End Sub`

Changed: , Category: ListView, File: T6C216M1577.htm, ID: 1577