Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple items deselected in ListView and other subclasses of ListBox #63

Merged
merged 1 commit into from
May 28, 2013

Conversation

rdingwall
Copy link
Contributor

Hi, first of all, many thanks for taking over this project. Here's a little pull request to fix a small bug: whenever I tried to select multiple items from a ListView and drag them, all the items would be deselected, except the single item I actually started dragging.

This was due to a bug in ItemsControlExtensions.GetSelectedItems():

if (itemsControl.GetType().IsAssignableFrom(typeof(ListBox)))
{
    var listBox = (ListBox)itemsControl;
    ...

This is too strict - the IsAssignableFromType() is round the wrong way (can you assign a base class to its subclass? no), so it fails to handle ListView and other subclasses of ListBox. My patch simply changes it to an is operator instead.

…nd other subclasses of ListBox would lose their selections if multiple items were selected.
punker76 added a commit that referenced this pull request May 28, 2013
Multiple items deselected in ListView and other subclasses of ListBox
@punker76 punker76 merged commit 44ebd7a into punker76:master May 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants