You tried?
<Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=Self}, Path=ContextMenu}" Value="{x:Null}"> <Setter Property="ContextMenu" Value="{DynamicResource ContextMenu}"/> </DataTrigger> </Style.Triggers>
But in fact, you have to configure the context menu in the control style, and then any user of the control can override it in the derived style or in the control attributes.
source share