I get properly selected object in TreeListView when reading SelectedObjects, however it fails when items are selected with shift key. In this case I get empty lists for SelectedObjects and SelectedIndices and SelectedIndex returns -1.
Display is showing proper selection.
I've tried traversing through all objects in tree and checking with IsSelected, but I get empty list as well.
Once I add with ctrl click some extra item I get proper selection again.
How can I get proper selection in this case? How can I disable shift selects otherwise?
Using ObjectListView 2.8.1
答案 0 :(得分:1)
正如Rev1.0所指出的,这是一个错误的事件处理程序的问题。回复SelectionChanged
会给出正确的结果。我没有在文档中找到它。
使用SelectedIndexChanged
而不是SelectionChanged
的原因是,在我的情况下,表单由另一个应用程序托管,该应用程序不会引发Application.Idle
事件。但是,可以使用CanUseApplicationIdle
属性轻松修复此问题。这是一个很好的控制。