tags:

views:

147

answers:

1

We need to have mouse clicks and drags "ignored" by our View1 but the ToolTip must still function in that view. The reason is View1 is above View2 in Z-Order, so View1 can tint View2 a red color and show a warning via ToolTip; however the ToolTip accompanying View1 will not work if IsHitTestVisible="False".

Anyone know a work around so the ToolTip will display on mouse move/over and the rest of mouse events are ignored by View1 and go to View2?

Thanks,

Sean

+1  A: 

What I did which is not great:

    private void UserControl_Loaded(object sender, RoutedEventArgs e)
    {
        var parentWindow = Window.GetWindow(this);
        var source = PresentationSource.FromVisual(parentWindow) as HwndSource;

        source.AddHook(WndProc);
    }

    private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
    {
        // Handle messages... 
        if (msg == WM_MOUSEMOVE)
        {
        ...show tool tip if mouse is over it
        }
        return IntPtr.Zero;
    }
Sean B