locked
Can not binding SelectedItems on Listview multiple mode.

    Question

  • Hi,

    I checked SelectedItems property of Listview class and see it not allow set values. It's mean that we can not binding data to it. Is there any way to set selected items of multiple Listview.

    Sincerely,

    Vu


    Vu Tran

    Saturday, March 21, 2015 8:01 AM

Answers

  • I found solution with 'ContainerContentChanging' event on ListView. Like this:

    private void MultiChoiceValues_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
    {
             ListViewItem _item = args.ItemContainer as ListViewItem;
             ...
             _item.IsSelected = true;
    ...
    }



    Vu Tran

    • Marked as answer by Vu_Tran Tuesday, March 24, 2015 3:18 PM
    Tuesday, March 24, 2015 3:17 PM

All replies

  • Not by default.
    Check out this Binding GridView.SelectedItems property for one possible solution.

    Sunday, March 22, 2015 1:12 AM
  • I found solution with 'ContainerContentChanging' event on ListView. Like this:

    private void MultiChoiceValues_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
    {
             ListViewItem _item = args.ItemContainer as ListViewItem;
             ...
             _item.IsSelected = true;
    ...
    }



    Vu Tran

    • Marked as answer by Vu_Tran Tuesday, March 24, 2015 3:18 PM
    Tuesday, March 24, 2015 3:17 PM