Мне нужно связать контекстное меню с тегом, но этот код не работает для меня.
<TextBox Width="100" Name="dd" Tag="jatin" Height="50" Text="{Binding Tag, RelativeSource={RelativeSource Self}}">
<TextBox.ContextMenu>
<ContextMenu>
<MenuItem Header="harsh"></MenuItem>
<MenuItem Header="jatin"></MenuItem>
<MenuItem Header="{Binding Path=Tag,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Grid},FallbackValue=BindingFailed}"></MenuItem>
</ContextMenu>
</TextBox.ContextMenu>
</TextBox>
</Grid>