title: Apply conditional styling in WPF
body: <p>I ran through one issue, need to apply conditional styling on Menu Item, here is a bit from my Code-Snippet:</p>
  
  <pre><code>&lt;Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,10,0,0"&gt;
      &lt;Menu HorizontalAlignment="Left" KeyboardNavigation.TabNavigation="Once" Background="Transparent" d:LayoutOverrides="Height"&gt;
          &lt;MenuItem Header="Menu1" Style="{DynamicResource M_Left}"  /&gt;
          &lt;MenuItem Header="Menu2" Style="{DynamicResource M_Middle}" /&gt;
          &lt;MenuItem Header="Menu3" Style="{DynamicResource M_Right}" Visibility="{Binding IsEligibleToDisplay, Converter={StaticResource MyVisibilityConverter}}" /&gt;
      &lt;/Menu&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>In above, IsEligibleToDisplay a bool property and MyVisibilityConverter sets Visibility either to Visible or Hidden on the basis of True or false.</p>
  
  <p><strong>What is expected?</strong></p>
  
  <p>If Visibility of "Menu3" is Hidden i.e. IsEligibleToDisplay = false then Style of "Menu2" should be Style="{DynamicResource M_Right}" otherwise Style="{DynamicResource M_Middle}"</p>
  
  <p>Something like (its just hypothetic, please do not check syntax - its wrong:)):</p>
  
  <pre><code>&lt;MenuItem Header="Menu2" Style="IsEligibleToDisplay ? {DynamicResource M_Middle} : {DynamicResource M_Right}" /&gt;  
  </code></pre>
  
  <p>Any help will be highly appreciated!</p>