I have a boolean property namely "messageinlistbox". I am trying to bind this property with the context menu. It is not working.
This is the following code which i am trying to implement.
ContextMenu Name="contextMenu" StaysOpen="true" Background="WhiteSmoke" IsEnabled="{Binding Path=messageinlistbox}" DataContext="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Self}}">
When i am trying to implement the following code it is working fine.
ContextMenu Name="contextMenu" StaysOpen="true" Background="WhiteSmoke" IsEnabled="false" DataContext="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Self}}">
Since my requirement is that the context menu should be dynamically enabled and disabled with respect to the boolean property "messageinlistbox" So, I cant use the second scenario.
IS it the right way I am doing binding or any other correct way to make the context menu enable and disable dynamically?