Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7630165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:02:01+00:00 2026-05-31T06:02:01+00:00

I have a ListView of items, and I want to run some code every

  • 0

I have a ListView of items, and I want to run some code every time the user selects or deselects an item without resorting to event handlers in the control’s codebehind – everything is being done in the view the control has its datacontext set to.

When the ListView’s selection mode is “Single” I can simply bind “SelectedItem” to a property in my view, and watch for when that property’s change event. If selection mode is “Multiple” however, the behaviour is completely unreliable. Sometimes the last item clicked changes the SelectedItem, and sometimes it doesn’t. This DependencyProperty appears to be complete trash when the selection mode isn’t single. How else can I use a binding to track changes to the ListView’s SelectedItems collection?

Note that I don’t use Expression blend so I won’t be using Interaction.Triggers or similar library solutions.

<ListView ItemsSource="{Binding Path=Zones}"  
          SelectionMode="Multiple"
          SelectedItem="{Binding SelectedZone}">
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:02:02+00:00Added an answer on May 31, 2026 at 6:02 am

    The only solution was to wrap the ItemsTemplate for the list in a control that can be toggled and has a command binding (like a button) and then bind the viewmodel to that command binding. It’s a huge pain and requires hacking around with the HitTestVisibility and binding the button’s state to the item’s selected state, but it works in the end.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an android listview filled with items. Every item has a button. This
I would have listview and a lot of items inside. I want that user
A have a ListView that is rendered with multiple items. Now I want to
I have a ListView with some items. I have toggleButton in each row of
I have a ListView and I want to select multiple items in the ListView
I have a Listview with some data.I want to get the number of click
I have a ListView with edit text in each items and I want to
i have a listview,now i want to perform on each listview items.I am using
I have the following problem: I display items on a ListView and I want
I have a listview with several items that are created dynamically, each has two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.