tags:

views:

244

answers:

1

I am trying to make a nice "drag and drop zone" in WPF that is displayed in the adorner layer when something is being dragged into the main application. The problem is that I do not get any events from my adorner, even though it according to documentation should receive all input events since it is in a higher z-order.

To debug my problem I created a really simple example where I have a user control with only a button in it. This user control is displayed in the adorner layer, but I cannot click the button. Why? What have I done wrong?

My adorner class is constructed like this:

    public ShellOverlayAdorner(UIElement element, AdornerLayer adornerLayer)
        :base(element)
    {
        _adornerLayer = adornerLayer;

        _overlayView = new AdornedElement();
        _overlayView.AllowDrop = true;
        _adornerLayer.Add(this);
     }

and is created in the main window by

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        adornerLayer = AdornerLayer.GetAdornerLayer(MyTopGridWithButtonInIt);
        ShellOverlayAdorner shell = new ShellOverlayAdorner(MyTopGridWithButtonInIt, adornerLayer);

    }

I do not get any events at all from my control, i.e. no mouse clicks, mouse over, button clicks. I cannot even click the button in the adorner layer. What have I done wrong?

A: 

HI, I have the same issue with Adorner. I have a Button in the Adorner content and its not receiving any click events. Whats wrong with my code...

Suda