How to bind Popup (or ContextMenu) PlacementTarget to an element in UserControl?

In the following scenario:

<Grid>
...
   <local:MyControl x:Name="MyCtl" Grid.Row="1"/>
   <Popup PlacementTarget="{Binding ???}"/>
<Grid>

I need to bind a PlacementTarget to a MyBtn button inside MyCtl. What is the cleanest way to do this?

+3
source share
1 answer
<Popup PlacementTarget="{Binding ElementName=MyCtl}" />
+1
source

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


All Articles