locked
ListView Items depress when I click on them

    Question

  • Hello,

    I'm having an issue where I click on an item in my list view, and the item depresses (shrinks slightly to indicate the click). However, when I release the mouse button or change the selection with my keyboard, the item stays depressed until I move my mouse off of the item I selected. I need the item to reset immediately, or have it so that the item doesn't depress at all.

    Is there a way of doing this? Any help would be appreciated.

    Thanks!

    Wednesday, October 24, 2012 8:51 PM

All replies

  • Hi DLAlex,

    The UI Design for Windows Store apps is for discussion by designers about what their Windows Store apps should look like. Questions about coding Windows Store apps will have different answers for different languages and UI formats and should be posted in the appropriate language forum.

    If you will let us know which language (JavaScript, C#, etc.) and UI toolkit (HTML, Xaml, DirectX) you are using then we can move this to the appropriate forum.

    It would also help if you can provide a minimal code snippet which demonstrates the problem and exact repro steps including clear descriptions of the expected and actual behavior. I was not able to obviously reproduce your symptoms with the standard template apps in either HTML or Xaml.

    --Rob

    Wednesday, October 24, 2012 9:16 PM
    Owner
  • Oh sorry, I'm using C++ with XAML. I thought since this was a UI issue it was right to post here. I now know for the future.

    Repro steps are simple. I just click on an item in my listview. The item depresses, and doesn't return to the normal until I move the mouse off of the item. I'd like it to return to normal when I let go of the mouse button.

    <ListView x:Name="ListView" SelectionChanged="ListView_SelectionChanged" Width="1147" Height="955" BorderThickness="5"> <ListViewItem> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition x:Name="ListView1_ImageColumn" Width="147"/> <ColumnDefinition x:Name="ListView1_NameColumn" Width="400"/> <ColumnDefinition x:Name="ListView1_DescriptionColumn" Width="600"/> </Grid.ColumnDefinitions> <StackPanel Grid.Column="0" HorizontalAlignment="Left" Margin="10,10,0,0"> <Image x:Name="ListView1_Image" Source="Assets/Artwork/Image1.png" Width="90" Height="90" Stretch="Fill"/> </StackPanel> <StackPanel Grid.Column="1" HorizontalAlignment="Left" Margin="0,30,0,0"> <TextBlock x:Name="ListView1_Name" Text="" TextAlignment="Center" TextWrapping="Wrap" FontSize="30" FontFamily="Segoe UI"/> </StackPanel> <StackPanel Grid.Column="2" HorizontalAlignment="Left" Margin="0,10,0,0"> <TextBlock x:Name="ListView1_Description" TextWrapping="Wrap" FontSize="30" FontFamily="Segoe UI" /> </StackPanel> </Grid> </ListViewItem>

    </ListView>

    There is how I'm creating my list view. There are 11 other items in the listview, but I omitted them as they are all the same, and I felt it would be overkill.

    Hope this helps, and my apologies.

    Thursday, October 25, 2012 2:04 PM
  • Thanks for clarifying. I can reproduce this now.

    It looks like the VisualState isn't getting reset from Pressed appropriately. This looks likely to be a bug in the control, but I haven't tracked it down fully. There probably isn't a straightforward workaround, but if you can override the control and detect the bad state you could call VisualStateManager::GoToState yourself.

    --Rob

    Friday, October 26, 2012 1:36 AM
    Owner