public static DependencyObject Getpopupplacementtarget (DependencyObject obj)
{
Return (DependencyObject) obj. GetValue (Popupplacementtargetproperty);
}
public static void Setpopupplacementtarget (DependencyObject obj, DependencyObject value)
{
Obj. SetValue (popupplacementtargetproperty, value);
}
<summary>
Popup Location Update
</summary>
public static readonly DependencyProperty Popupplacementtargetproperty =
Dependencyproperty.registerattached ("Popupplacementtarget", typeof (DependencyObject), typeof (Popuphelper), new PropertyMetadata (NULL, onpopupplacementtargetchanged));
private static void Onpopupplacementtargetchanged (DependencyObject D, DependencyPropertyChangedEventArgs e)
{
if (e.newvalue! = null)
{
DependencyObject popuppopupplacementtarget = E.newvalue as DependencyObject;
Popup pop = d as Popup;
if (popuppopupplacementtarget! = null)
{
Window w = Window.getwindow (popuppopupplacementtarget);
if (null! = W)
{
w.locationchanged + = Delegate
{
var offset = pop. HorizontalOffset;
Pop. HorizontalOffset = offset + 1;
Pop. HorizontalOffset = offset;
};
}
}
}
}
Popup Position updates with window move