none
Positioning a Popup relative to a Window RRS feed

  • Question

  • Hi,

    I use a popup and open it relative to a WPF window. When moving the window the popup stays at its original position. I would expect the popup to stay in its position relative to the window, and thus, moving with the window. Is there a way to achieve such a behaviour in XAML without any code?

    Thanks
    Christian

    Thursday, January 26, 2012 9:42 PM

Answers

  • Hi Christian,

    No, I don't think we can do this without any code.

    A popup is actually a independent window. It won't move with the original window. You will need to write code to adjust its position.

    Why you don't want any code? If you look for a one-click solution, the answer is it doesn't exist.

    If you don't want code because of MVVM pattern, you can apply Attached Behavior Pattern here to resolve the problem.

    Hope this helps.


    Min Zhu [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Mr Sparkle Friday, January 27, 2012 4:59 PM
    Friday, January 27, 2012 6:10 AM
    Moderator