Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In ItemsContainerStyle for <code>TabControl</code>, create a DataTrigger where you bind to your property (e.g <code>IsDiscontinued</code>) and set the Opacity from there</p> <pre><code>&lt;TabControl ItemsSource="{Binding Products}" Name="ProductsTabControl"&gt; &lt;TabControl.ItemContainerStyle&gt; &lt;Style TargetType="TabItem"&gt; &lt;Style.Triggers&gt; &lt;DataTrigger Binding="{Binding IsDiscontinued}" Value="True"&gt; &lt;Setter Property="Opacity" Value="0.2"/&gt; &lt;/DataTrigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; &lt;/TabControl.ItemContainerStyle&gt; &lt;TabControl.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;TextBlock Text="{Binding Name}"/&gt; &lt;/DataTemplate&gt; &lt;/TabControl.ItemTemplate&gt; &lt;/TabControl&gt; </code></pre> <p><strong>Update</strong> </p> <p>If you want to make the Content of the discontinued tabs semi-transparent you can do the same thing, but in the <code>DataTemplate</code></p> <pre><code>&lt;TabControl ItemsSource="{Binding Products}" Name="ProductsTabControl"&gt; &lt;TabControl.Resources&gt; &lt;DataTemplate DataType="{x:Type local:Product}"&gt; &lt;Border Name="bg" BorderBrush="Black" BorderThickness="1"&gt; &lt;TextBlock Text="{Binding Name}"/&gt; &lt;/Border&gt; &lt;DataTemplate.Triggers&gt; &lt;DataTrigger Binding="{Binding IsDiscontinued}" Value="True"&gt; &lt;Setter TargetName="bg" Property="Opacity" Value="0.2"/&gt; &lt;/DataTrigger&gt; &lt;/DataTemplate.Triggers&gt; &lt;/DataTemplate&gt; &lt;/TabControl.Resources&gt; &lt;!--...--&gt; &lt;/TabControl&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload