Wpf popup capture while restricting main window

From what I understand, a pop-up window exists inside it of its own visual tree. However, I noticed several properties, Clip and ClipToBounds. What I want to do is visually crop the popup at the right and bottom edges of the window, regardless of the fact that the popup is independent of the borders of the window. I do not use XAML, but if someone knows how to do this in XAML, then that’s fine. I can get to the main window using System.Windows.Application.Current.MainWindow. Is it possible to get a value from this that I can use to create a popup? I assume that if there is a value that I can use, I would be able to bind the popup crop to this value. This is really not necessary, because after a pop-up window initially opens, if the window moves or changes,popup closes. So I really would only need to copy the popup when it opens. The reason I would like to do this is because although I use a popup, I do not want it to appear as a popup that exists outside of the window. FYI is for a pop-up calendar for a custom date field. Any ideas, as well as an explanation of the misconceptions that may arise in me, will be greatly appreciated.FYI is for a pop-up calendar for a custom date field. Any ideas, as well as an explanation of the misconceptions that may arise in me, will be greatly appreciated.FYI is for a pop-up calendar for a custom date field. Any ideas, as well as an explanation of the misconceptions that may arise in me, will be greatly appreciated.

+3
source share
2 answers

In addition, a pop-up window can be launched from a user control that is not located directly in the main window. Therefore, in this case, it would be easier to use a popup. Like UC inside XAML

+1
source

I know this is an old post, but in case others come here to look for answers ... If you do not need to pop up to be outside your window, why use a pop-up window? It would be much easier to just use a control in the canvas (for example) and manage it using the Visibility property. Then you will automatically get your circumcision.

0
source

Source: https://habr.com/ru/post/1708757/


All Articles