Popup  
Author Message
CodeDjinn





PostPosted: Windows Presentation Foundation (WPF), Popup Top

Hi,

How do you make a PopUp follow the form when the form is dragged

Thank you,

Jaco



Visual Studio 20089  
 
 
Neil Kronlage





PostPosted: Windows Presentation Foundation (WPF), Popup Top

Popup does not have support for listening to position changes of its placement target. You can listen to window moves and reposition the popup by changing the HorizontalOffset and VerticalOffset properties. However there is a bug in the FebCTP where these properties don't change the position of the popup unless it is reopened (this will be fixed in the next release).

You may consider using an Adorner. It allows rendering on top of all other content in the window and will automatically move as the window moves. The adorner allows transparency and will be hardware accelerated where popups with transparency fall back to software rendering. Adorners do not draw outside of the window however.



 
 
CodeDjinn





PostPosted: Windows Presentation Foundation (WPF), Popup Top

Thank you very much for the info.

Do you know then how the popup determines the position of the controls on any type of container (Canvas, Grid, Stackpane...) E.g if you specify the popup's placement target, .PlacementTarget = someControl, the popup will know exactly where the control is, it does not matter how deep the someControl is nested inside the grid. I would really like to know how to determine such positioning.

Thanks,

Jaco


 
 
eburke





PostPosted: Windows Presentation Foundation (WPF), Popup Top

if you have a handle on the control and a handle on the grid, you can use TranslatePoint.

e.g., Point pt = ctl.TranslatePoint( new Point(0,0), grid );

will give you the upper-left corner of the control relative to the upper-left corner of the grid.


 
 
Tomi B.





PostPosted: Windows Presentation Foundation (WPF), Popup Top

It looks like the repositioning of a popup bug wasn't fixed for Beta 2, is this correct

//Tomi B.


 
 
Tomi B.





PostPosted: Windows Presentation Foundation (WPF), Popup Top

OK, disregard the previous post. The June CTP came out today and fixes the issue.

//TB