0
votes

I have a ListView which consists of Movie Genres. User can select multiple genres. It is saved in Database.

In Admin Mode, I want to have the same ListView: Checkbox and Value. Only here Admin can't change the SelectedItems. I want the selection of ListView to be disabled. I have tried following steps:

  1. The checkbox is gone if I set SelectionMode from Multiple to None as there is no "DisableSelection".
  2. If I make IsHitTestVisible into False: I can't scroll the ListView
  3. I have tried to modify the Style (ListViewItem) where I set MultiSelectSquare Visibility to always Visible and I also deleted MultiSelectClipTransform since this element hides the Checkbox if the SelectionMode is not multiple. The thing is: the checkbox is there but all items' selectedvalue is unselected.

Does anybody have a workaround?

1

1 Answers

0
votes

If I am correct, then you need a ListView which has everything of a normal ListView, but the user(admin for your case) can't change the selection.

If that's the case, then I have got a solution for you. Just set the HitTestVisible property of ItemsPanel to false. Like this:

<ListView SelectionMode="Multiple" IsItemClickEnabled="False">
     <ListView.ItemsPanel>
         <ItemsPanelTemplate>
             <ItemsStackPanel Orientation="Vertical" IsHitTestVisible="False"/>
         </ItemsPanelTemplate>
     </ListView.ItemsPanel>
</ListView>