How can I binding a style to Controls
<p>I try to make blinking style fro Image, and I intend to assign this style dynamically and assign this style for some image that has dependency property HasError, when HasErro=True the image blinking otherwise not blinking and style set to null.</p>

<p>here is my style that works correctly:</p>

<pre><code>&lt;Style x:Key="myImageAnimateStyle"&gt;
        &lt;Style.Triggers&gt;
            &lt;EventTrigger RoutedEvent="FrameworkElement.Loaded"&gt;
                &lt;BeginStoryboard&gt;
                    &lt;Storyboard&gt;
                        &lt;DoubleAnimation Storyboard.TargetProperty="(UIElement.Opacity)"
                           BeginTime="0:0:0" Duration="0:0:0.5"
                           From="1.0" To="0.0" RepeatBehavior="Forever" AutoReverse="True"/&gt;

                    &lt;/Storyboard&gt;
                &lt;/BeginStoryboard&gt;
            &lt;/EventTrigger&gt;
        &lt;/Style.Triggers&gt;
    &lt;/Style&gt;
</code></pre>

<p>and this is my style binding:</p>

<pre><code>&lt;Image x:Name="imgErro" Style="{Binding HasError, Converter={StaticResource ErrorBooleanAnimate}, ElementName=userControl}"/&gt;
</code></pre>

<p>and this is my Value converter with two solution but doesn't work:</p>

<pre><code>    public class ErrorBooleanAnimate : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (!(value is bool?))
            return null;

        if ((bool)value == true)
        {
            // Solution 1
            //return "{DynamicResource myImageAnimateStyle}";

            // Solution 2
            Style newStyle = (Style)Application.Current.TryFindResource("myImageAnimateStyle");
            return newStyle;
        }
        else
        {
            return null;
        }
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}
</code></pre>

<p>what is the best solution for this issue?</p>