I have a Popup defined like this:
<Popup
Name="myPopup"
StaysOpen="True"
Placement="Bottom"
PlacementRectangle="0,20,0,20"
PlacementTarget="{Binding ElementName=myPopupAnchor}">
<TextBlock ... />
</Popup>
I have added event handlers to the myPopupAnchor
for the events MouseEnter
and MouseLeave
. The two event handlers toggles the popups visibility.
My problem is the position of myPopupAnchor is only read when the popup is first shown, or hidden and then shown again. If the anchor moves, the popup does not.
Im Looking for ways to work around this, I want a moving Popup. Can I notify WPF that the PlacementTarget
binding has changed and should be read again? Can I manually set the popups position?
Currently, I have a very crude workaround that involves closing and then opening the popup again, which causes some repainting issues.