Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

Popup control and MouseLeave event RSS

4 replies

Last post Feb 23, 2011 07:58 PM by gary frank

(0)
  • Puts

    Puts

    Member

    31 Points

    27 Posts

    Popup control and MouseLeave event

    May 14, 2008 02:06 PM | LINK

    Hello, i have a Popup control that loads a differenct xaml page.  In the main page I create a new popup control and privatly store it for class use.  In my button event i get the popup, calculate its location and open it up.  In the constructor for the main page i attach the popups MouseLeave event so when they hover out of the popup it will close.  This event is never getting fired, i hover over and out while debugging and it just never gets into the event.  Is this not functional for popup controls yet?

  • robhouweling

    robhouweling

    Contributor

    3308 Points

    565 Posts

    Re: Popup control and MouseLeave event

    May 14, 2008 03:52 PM | LINK

    This seems like a bug. According to the msdn library(http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.popup_members(VS.95).aspx) it should be a valid event (popup is derived from UIElement) and should work with the popup.

    When I use this code it never falls into the events (set a breakpoint on the throw):  public Page()
    {
        InitializeComponent();
        this.Loaded += new RoutedEventHandler(Page_Loaded);
        PopupTest.MouseEnter +=
    new MouseEventHandler(PopupTest_MouseEnter);
        PopupTest.MouseLeave +=
    new MouseEventHandler(PopupTest_MouseLeave);
    }

    void PopupTest_MouseEnter(object sender, MouseEventArgs e)
    {
        throw new NotImplementedException();
    }

    void PopupTest_MouseLeave(object sender, MouseEventArgs e)
    {
        throw new NotImplementedException();
    }

    (If this has answered your question, please click on mark as answer on this post)



    Cheers!

    Rob Houweling





    My blog
  • Puts

    Puts

    Member

    31 Points

    27 Posts

    Re: Popup control and MouseLeave event

    May 14, 2008 06:21 PM | LINK

    Yeah i think its a bug, thanks for confirming for me.

  • Orkun.Ozen

    Orkun.Ozen

    Member

    12 Points

    14 Posts

    Re: Popup control and MouseLeave event

    Feb 23, 2011 01:01 PM | LINK

    Any updates on the issue yet? :)

  • Gary Frank

    Gary Frank

    Member

    294 Points

    163 Posts

    Re: Popup control and MouseLeave event

    Feb 23, 2011 07:58 PM | LINK

    Maybe the mouse is never over the popup control itself -- it's over one of the controls within the popup.  Have you tried putting the Mouse_Leave event on one of them, such as a Border?

    Would you post your xaml here too?  Let's see which controls the mouse is able to move over.

    Gary Frank