[UWP][VB]Using ListBox.SelectedItems RRS feed

  • Question

  • I have a ListBox with SelectionMode="Extended" and would like to use the SelectedItems property. However, when I try to do this it doesn't seem to work, it says that SelectedItems is a System._ComObject, but I was expecting it to be an IList(Of Object) (or something like that). How do I get the selected items from the ListBox? Any help would be appreciated. Thanks.

    Nathan Sokalski

    Tuesday, May 2, 2017 7:53 PM

All replies

  • The SelectedItems property returns IVector<object>, not a concrete class. You can use SelectedItems.Count to determine if any items are selected and then access them directly through SelectedItems(x).
    • Proposed as answer by Barry Wang Friday, May 19, 2017 7:54 AM
    Wednesday, May 3, 2017 1:21 AM
  • I believe normal .net application also use IVector<T> but due to .net language protection, IList<T> is public to everyone, but IVector<T> not. 

    In another word, plz use IVector<T> similar like IList<T>


    • Proposed as answer by Barry Wang Friday, May 26, 2017 6:47 AM
    Wednesday, May 3, 2017 9:09 AM