Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1770
hiding context menu based on record index
posted

Hello.

How can I prevent the context menu from appearing based on the index the user click on in xamdatagrid? I imagine that I would use a data trigger but how do I get the right-clicked on record's index in xaml?

<ContextMenu.Style>
<Style TargetType="{x:Type ContextMenu}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=PlacementTarget.Record}" Value="-1">
<Setter Property="Visibility" Value="Hidden"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ContextMenu.Style>