punker76 / gong-wpf-dragdrop

The GongSolutions.WPF.DragDrop library is a drag'n'drop framework for WPF
BSD 3-Clause "New" or "Revised" License
2.31k stars 401 forks source link

Adorner does not work in UserControl #347

Closed Michael-Arend closed 4 years ago

Michael-Arend commented 4 years ago

UPDATE: I changed the window structure, and removed the ControlTemplate, now it works fine. But the Issue is still there, even if it is pretty special one.

What steps will reproduce this issue?

I have two Listviews in an Usercontrol, which is embedded in a Window as part of a ControlTemplate.

<Window>

<Window.Resources>
        <Style TargetType="{x:Type local:ShellView}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Window}">
                          <ContentControl  Content="{Binding DragDropViewModel}">
</ContentControl>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
</Window>

Expected outcome

Everytime I set UseDefaultDragAdorner="True" no Drop is possible and so no Adorner is shown. Without UseDefaultDragAdorner="True" everything works fine. If i convert the Usercontrol into a window everything works fine, but then i cant use it as i want to. Is it a know Issue, that UserControls are not supported?

Environment

ogiesen commented 4 years ago

UPDATE: I changed the window structure, and removed the ControlTemplate, now it works fine.

Could you elaborate on this a little? What exactly did you do to make it work fine?

I think I might have the same or at least a related issue and haven't been able to solve it yet...

Michael-Arend commented 4 years ago

I do not use a controltemplate anymore. So i think the problem was, that the Contentcontrol was in the resources. Now it is just in the window grid and works fine:

ogiesen commented 4 years ago

I do not use a controltemplate anymore. So i think the problem was, that the Contentcontrol was in the resources. Now it is just in the window grid and works fine:

OK, then mine must be a different issue. I think I never had a ContentControl inside a ControlTemplate to begin with... I do have multiple nested UserControls though, some of them loaded inside ContentControl-elements via Content="{Binding MyNestedView}"... I never get to see any adorners and if I enable UseDefaultDragAdorner I also cannot do drag&drop at all.