haithambradai / gong-wpf-dragdrop

Automatically exported from code.google.com/p/gong-wpf-dragdrop
0 stars 0 forks source link

Crash when using items deriving from ContentControl #42

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use a control that derives from ContentControl (Label, Button) for the 
ItemTemplate in the ItemsControl, like in this example:

            <ItemsControl ItemsSource="{Binding Collection}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                            <Label>WhatEver</Label>  
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>

What is the expected output? What do you see instead?
- When you try to drag any item, an exception is thrown.

What version of the product are you using? On what operating system?
- 1.3, XP

Please provide any additional information below.

It all happens in DragInfo's constructor. 
This line fails to retrieve the correct container:
UIElement item = itemsControl.GetItemContainer((UIElement)e.OriginalSource);

Therefore itemParent is null:
ItemsControl itemParent = ItemsControl.ItemsControlFromItemContainer(item);

Original issue reported on code.google.com by natxm...@gmail.com on 15 Dec 2011 at 10:10