0

I need to provide my users with the ability to display a vertical list of items in a UWP app. The user should be able to tap items to perform some actions and to reorder them by dragging, but without the ability to select them. The UWP ListView is a good candidate for this. I would use this control with the following settings to implement what I need (a simplified form):

<ListView CanReorderItems="True" AllowDrop="True" SelectionMode="None">
    <ListViewItem>Blue</ListViewItem>
    <ListViewItem>Red</ListViewItem>
    <ListViewItem>Yellow</ListViewItem>
    <ListViewItem>Green</ListViewItem>
</ListView>

Sure, in the real app I use data binding through the ItemsSource property and my custom item template looks like this:

<ListView.ItemTemplate>
    <DataTemplate>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="50" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Rectangle Height="50" Width="50" Fill="RosyBrown" />
            <TextBlock Grid.Column="1" Text="Some text" />
        </Grid>
    </DataTemplate>
</ListView.ItemTemplate>

Unfortunately, I could not find a good and simple way to do what I need. My main problem is the selection in ListView. For instance, even if I set the ListView's SelectionMode to None, the items are still highlighted when the user is moving the mouse pointer over them. The IsHitTestVisible property also does not help as we can't tap and drag items if we set it to False.

Is there a way to solve my problem?

TecMan
  • 2,743
  • 2
  • 30
  • 64
  • Change the background color of selected item . Here is the link for that http://stackoverflow.com/questions/32302146/how-to-change-highlight-color-of-the-selected-listview-item-in-uwp-windows-10 – Archana Mar 17 '16 at 05:14
  • @user2354187, thank you for the tip. In my case, I needed to set the `PressedBackground` and `PointerOverBackground` properties of the modified ListViewItem style to `Transparent`. Here is another SO topic about that: http://stackoverflow.com/questions/23321860/change-listview-item-selection-style/23547750 – TecMan Mar 17 '16 at 09:36

0 Answers0