<p>I have a DataTrigger defined in my XAML which I want to use in several places. Is it possible to define it as a resource and then share it?</p>

<p>Here's my trigger:</p>

<pre><code>&lt;TextBlock.Style&gt;
    &lt;Style&gt;
        &lt;Style.Triggers&gt;
            &lt;DataTrigger Binding="{Binding HasCurrentTest}" Value="True"&gt;
                &lt;Setter Property="TextBlock.Visibility" Value="Hidden" /&gt;
            &lt;/DataTrigger&gt;
        &lt;/Style.Triggers&gt;
    &lt;/Style&gt;
&lt;/TextBlock.Style&gt;
</code></pre>

<p>While I can define this in my Window.Resources and give it a key, how do I refer to it in the rest of my XAML?</p>

If the style is in the Windows.Resources with a key, each element can add it to their own style like this.
```
```
<Window.Resources>
    <Style x:Key="YourStyleKey">
        <!-- Your Style -->
    </Style>
</Window.Resources>

<TextBox Text="SomeText" Style="{StaticResource YourStyleKey}"/>
<TextBox Text="SomeOtherText" Style="{StaticResource YourStyleKey}"/>
```
```