Clip a wpf Popup at bounds of a main window

Posted by BrandonS on Stack Overflow See other posts from Stack Overflow or by BrandonS
Published on 2009-05-20T16:27:59Z Indexed on 2010/05/20 5:40 UTC
Read the original article Hit count: 1380

Filed under:
|
|
|

From what I understand, the popup exists within it's own visual tree. However, I've noticed a few properties, Clip and ClipToBounds. What I am wanting to do is Visually clip a popup at the right and bottom edges of a window regardless of the fact that the popup is independent of the bounds of the window. I'm not using XAML, but if somebody knows how to do it in XAML, then that's fine. I can get to the main window using System.Windows.Application.Current.MainWindow. Is it possible from this to get a value that I can use to clip the popup? I'm assuming that if there is a value that I can use, then I would be able to bind the clipping of the popup to that value. This is really not necessary since after the popup initially opens, if the window gets moved or resized, the popup closes. So I would really only need to clip the popup when it opens. The reason I would like to do this is because although I am using a popup, I don't want it to appear as a popup that exists outside of the window. FYI this is for a popup calendar for a custom datebox. Any ideas, as well as clarification of misconceptions that I may have, would be greatly appreciated.

Thanks, Brandon

© Stack Overflow or respective owner

Related posts about wpf

Related posts about popup