0
votes

xaml file in my WPF showing this error :-

System.Windows.Markup.XamlParseException was unhandled Message: An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll Additional information: 'Provide value on 'System.Windows.StaticResourceExtension' threw an exception.' Line number '42' and line position '60'.

Below is the code of Dictionary1.xaml:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:system="clr-namespace:System;assembly=mscorlib">
<!--xmlns:local="clr-namespace:HM.Desktop.Themes">-->

<!--Basic Brushes-->
<Color x:Key="PrimaryColor">#FF63AADA</Color>
<Color x:Key="SecondaryColor">#FFA0FCFF</Color>
<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource PrimaryColor}" />
<SolidColorBrush x:Key="SecondaryBrush" Color="{StaticResource SecondaryColor}" />
<SolidColorBrush x:Key="TextBrush"  Color="#FF152937" />
<SolidColorBrush x:Key="DisabledColor" Color="#8CFFFFFF" />
<SolidColorBrush x:Key="BackgroundBrush" Color="#FFFFFFFF" />
<LinearGradientBrush x:Key="MainBackground"  EndPoint="0.5,1"  StartPoint="0.5,0">
    <GradientStop Color="#FFCEDEFF"  Offset="0" />
    <GradientStop Color="#FF5A7CA0" Offset="0.992" />
    <GradientStop Color="#FF5882A7" Offset="0.085" />
</LinearGradientBrush>
<SolidColorBrush x:Key="WaitingAnimationColor" Color="DarkBlue" />

<!-- Button -->
<Style TargetType="Button">
    <Setter Property="Foreground" Value="{StaticResource TextBrush}" />
    <!--<Setter Property="Background" Value="#00000000" />-->
    <Setter Property="Background" Value="#000000FF" />
    <Setter Property="Padding" Value="5,4" />
    <Setter Property="Height" Value="35" />
    <Setter Property="FontSize" Value="14" />
    <Setter Property="FontWeight" Value="Bold" />
    <Setter Property="BorderBrush" Value="{StaticResource PrimaryBrush}" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="Button">
                <Grid x:Name="Button_Normal">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="50*" />
                        <RowDefinition Height="50*" />
                    </Grid.RowDefinitions>
                    <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="FocusStates">
                            <VisualState x:Name="Unfocused" />
                            <VisualState x:Name="Focused">
                                <Storyboard>
                                    <ColorAnimationUsingKeyFrames Duration="00:00:00.001" Storyboard.TargetName="InnerBorder"
                                                                  Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
                                        <SplineColorKeyFrame KeyTime="0" Value="#BF000000" />
                                    </ColorAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                        <VisualStateGroup x:Name="CommonStates">
                            <VisualStateGroup.Transitions>
                                <VisualTransition GeneratedDuration="00:00:00.3" />
                                <VisualTransition From="MouseOver" GeneratedDuration="00:00:00" To="Pressed" />
                                <VisualTransition From="MouseOver" GeneratedDuration="00:00:00.1" To="Normal" />
                            </VisualStateGroup.Transitions>
                            <VisualState x:Name="MouseOver">
                                <Storyboard>
                                    <DoubleAnimationUsingKeyFrames Duration="00:00:00.001" Storyboard.TargetName="Background"
                                                                   Storyboard.TargetProperty="(UIElement.Opacity)">
                                        <SplineDoubleKeyFrame KeyTime="0" Value="1" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Duration="00:00:00.001" Storyboard.TargetName="Highlight"
                                                                   Storyboard.TargetProperty="(UIElement.Opacity)">
                                        <SplineDoubleKeyFrame KeyTime="0" Value="1" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <ColorAnimationUsingKeyFrames Duration="00:00:00.001" Storyboard.TargetName="Shadow"
                                                                  Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                        <SplineColorKeyFrame KeyTime="0"
                                                             Value="#4B000000" />
                                    </ColorAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Duration="00:00:00.001"
                                                                   Storyboard.TargetName="Background"
                                                                   Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Offset)">
                                        <SplineDoubleKeyFrame KeyTime="0"
                                                              Value=".1" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <ColorAnimationUsingKeyFrames Duration="00:00:00.001"
                                                                  Storyboard.TargetName="Highlight"
                                                                  Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                        <SplineColorKeyFrame KeyTime="0"
                                                             Value="#4AFFFFFF" />
                                    </ColorAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                            <VisualState x:Name="Normal" />
                            <VisualState x:Name="Pressed">
                                <Storyboard>
                                    <DoubleAnimationUsingKeyFrames Duration="00:00:00.001"
                                                                   Storyboard.TargetName="Background"
                                                                   Storyboard.TargetProperty="(UIElement.Opacity)">
                                        <SplineDoubleKeyFrame KeyTime="0"
                                                              Value="0.6" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Duration="00:00:00.001"
                                                                   Storyboard.TargetName="Background"
                                                                   Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Offset)">
                                        <SplineDoubleKeyFrame KeyTime="0"
                                                              Value="0" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <ColorAnimationUsingKeyFrames Duration="00:00:00.001"
                                                                  Storyboard.TargetName="White"
                                                                  Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
                                        <SplineColorKeyFrame KeyTime="0"
                                                             Value="#FF000000" />
                                    </ColorAnimationUsingKeyFrames>
                                    <ColorAnimationUsingKeyFrames Duration="00:00:00.001"
                                                                  Storyboard.TargetName="White"
                                                                  Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                        <SplineColorKeyFrame KeyTime="0"
                                                             Value="#FFC8C8C8" />
                                    </ColorAnimationUsingKeyFrames>
                                    <ColorAnimationUsingKeyFrames Duration="00:00:00.001"
                                                                  Storyboard.TargetName="Highlight"
                                                                  Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                        <SplineColorKeyFrame KeyTime="0"
                                                             Value="#4BFFFFFF" />
                                    </ColorAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Duration="00:00:00.001"
                                                                   Storyboard.TargetName="Highlight"
                                                                   Storyboard.TargetProperty="(UIElement.Opacity)">
                                        <SplineDoubleKeyFrame KeyTime="0"
                                                              Value="0.5" />
                                    </DoubleAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                            <VisualState x:Name="Disabled">
                                <Storyboard>
                                    <DoubleAnimationUsingKeyFrames Duration="00:00:00.001"
                                                                   Storyboard.TargetName="contentPresenter"
                                                                   Storyboard.TargetProperty="(UIElement.Opacity)">
                                        <SplineDoubleKeyFrame KeyTime="0"
                                                              Value="0.5" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Duration="00:00:00.001"
                                                                   Storyboard.TargetName="Background"
                                                                   Storyboard.TargetProperty="(UIElement.Opacity)">
                                        <SplineDoubleKeyFrame KeyTime="0"
                                                              Value="0.2" />
                                    </DoubleAnimationUsingKeyFrames>
                                    <ColorAnimationUsingKeyFrames Duration="00:00:00.001"
                                                                  Storyboard.TargetName="White"
                                                                  Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
                                        <SplineColorKeyFrame KeyTime="0"
                                                             Value="#FFB1B1B1" />
                                    </ColorAnimationUsingKeyFrames>
                                    <ColorAnimationUsingKeyFrames Duration="00:00:00.001"
                                                                  Storyboard.TargetName="White"
                                                                  Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
                                        <SplineColorKeyFrame KeyTime="0"
                                                             Value="#FFECECEC" />
                                    </ColorAnimationUsingKeyFrames>
                                    <ColorAnimationUsingKeyFrames Duration="00:00:00.001"
                                                                  Storyboard.TargetName="White"
                                                                  Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                        <SplineColorKeyFrame KeyTime="0"
                                                             Value="#FFECECEC" />
                                    </ColorAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                    <Border CornerRadius="4"
                            Grid.RowSpan="2"
                            x:Name="White"
                            BorderBrush="#FFFFFFFF"
                            BorderThickness="1.2">
                        <Border.Background>
                            <RadialGradientBrush>
                                <RadialGradientBrush.RelativeTransform>
                                    <TransformGroup>
                                        <ScaleTransform CenterX="0.5"
                                                        CenterY="0.5"
                                                        ScaleX="1.35"
                                                        ScaleY="1.35" />
                                    </TransformGroup>
                                </RadialGradientBrush.RelativeTransform>
                                <GradientStop Color="#FFFFFFFF"
                                              Offset="0" />
                                <GradientStop Color="#FFFFFFFF"
                                              Offset="1" />
                            </RadialGradientBrush>
                        </Border.Background>
                    </Border>
                    <Border BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="1.2"
                            CornerRadius="4"
                            x:Name="Background"
                            Grid.RowSpan="2"
                            Opacity="0.65">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="0.5,1.4"
                                                 StartPoint="0.5,0">
                                <GradientStop Color="{StaticResource PrimaryColor}"
                                              Offset="0.75" />
                                <GradientStop Color="{StaticResource SecondaryColor}"
                                              Offset="1" />
                            </LinearGradientBrush>
                        </Border.Background>
                    </Border>
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="#7FFFFFFF"
                            BorderThickness="1"
                            CornerRadius="3.5"
                            x:Name="InnerBorder"
                            Margin="1"
                            Grid.RowSpan="2" />
                    <Border CornerRadius="3.5"
                            x:Name="Shadow"
                            Margin="2"
                            Grid.RowSpan="2">
                        <Border.OpacityMask>
                            <RadialGradientBrush>
                                <RadialGradientBrush.RelativeTransform>
                                    <TransformGroup>
                                        <TranslateTransform X="0"
                                                            Y="-0.5" />
                                    </TransformGroup>
                                </RadialGradientBrush.RelativeTransform>
                                <GradientStop Color="#00FFFFFF"
                                              Offset="0.3" />
                                <GradientStop Color="#FFFFFFFF"
                                              Offset="1" />
                            </RadialGradientBrush>
                        </Border.OpacityMask>
                        <Border.Background>
                            <RadialGradientBrush>
                                <RadialGradientBrush.RelativeTransform>
                                    <TransformGroup>
                                        <ScaleTransform CenterX="0.5"
                                                        CenterY="0.5"
                                                        ScaleX="1.75"
                                                        ScaleY="2.25" />
                                        <TranslateTransform Y="0.65" />
                                    </TransformGroup>
                                </RadialGradientBrush.RelativeTransform>
                                <GradientStop Color="#00000000"
                                              Offset="0.55" />
                                <GradientStop Color="#33000000"
                                              Offset="1" />
                            </RadialGradientBrush>
                        </Border.Background>
                    </Border>
                    <Border Margin="1,1,1,0"
                            CornerRadius="4,4,40,40"
                            x:Name="Highlight"
                            Opacity="0.8"
                            RenderTransformOrigin="0.5,1">
                        <Border.Background>
                            <RadialGradientBrush>
                                <RadialGradientBrush.RelativeTransform>
                                    <TransformGroup>
                                        <ScaleTransform CenterX="0.5"
                                                        CenterY="0.5"
                                                        ScaleX="1.25"
                                                        ScaleY="2" />
                                        <TranslateTransform Y="-0.6" />
                                    </TransformGroup>
                                </RadialGradientBrush.RelativeTransform>
                                <GradientStop Color="#BFFFFFFF"
                                              Offset="0" />
                                <GradientStop Color="#4CFFFFFF"
                                              Offset="1" />
                            </RadialGradientBrush>
                        </Border.Background>
                    </Border>
                    <ContentPresenter x:Name="contentPresenter"
                                      HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                      VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                      Margin="{TemplateBinding Padding}"
                                      RenderTransformOrigin="0.5,0.5"
                                      Grid.RowSpan="2" />
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
</ResourceDictionary>

Here is the code where error occurred in the line : <VisualState x:Name="Focused">

enter image description here

1
You're certain this is the right file?15ee8f99-57ff-4f92-890c-b56153
Yes 100% sure just copied and deleted the unnecessary code for other controls, only kept the code where error occurred.agileDev
Delete it. It doesn't illustrate anything that'll help anybody.15ee8f99-57ff-4f92-890c-b56153
Thanks to every one for sharing their thoughts. I'm using this resource file for a MVVM system with region manager. Different view with different modules are attached to the region manager with different regions , I found that they are sharing the same resource file and one of the views was not able to find resource name, so the error occurred.agileDev

1 Answers

0
votes

The Style you have provided works and I just tested it by creating a simple window. This style is not causing the issue. A Static Resource is being used before it is called is all the error states.

<Window x:Class="WpfApplication1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:WpfApplication1"
    mc:Ignorable="d"
    Title="MainWindow" Height="350" Width="525">
<Window.Resources>
    <Color x:Key="PrimaryColor">#FF63AADA</Color>
    <Color x:Key="SecondaryColor">#FFA0FCFF</Color>
    <SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource PrimaryColor}" />
    <SolidColorBrush x:Key="SecondaryBrush" Color="{StaticResource SecondaryColor}" />
    <SolidColorBrush x:Key="TextBrush"  Color="#FF152937" />
    <SolidColorBrush x:Key="DisabledColor" Color="#8CFFFFFF" />
    <SolidColorBrush x:Key="BackgroundBrush" Color="#FFFFFFFF" />
    <LinearGradientBrush x:Key="MainBackground"  EndPoint="0.5,1"  StartPoint="0.5,0">
        <GradientStop Color="#FFCEDEFF"  Offset="0" />
        <GradientStop Color="#FF5A7CA0" Offset="0.992" />
        <GradientStop Color="#FF5882A7" Offset="0.085" />
    </LinearGradientBrush>
    <SolidColorBrush x:Key="WaitingAnimationColor" Color="DarkBlue" />

    <!-- Button -->
    <Style TargetType="Button">
        <Setter Property="Foreground" Value="{StaticResource TextBrush}" />
        <!--<Setter Property="Background" Value="#00000000" />-->
        <Setter Property="Background" Value="#000000FF" />
        <Setter Property="Padding" Value="5,4" />
        <Setter Property="Height" Value="35" />
        <Setter Property="FontSize" Value="14" />
        <Setter Property="FontWeight" Value="Bold" />
        <Setter Property="BorderBrush" Value="{StaticResource PrimaryBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid x:Name="Button_Normal">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="50*" />
                            <RowDefinition Height="50*" />
                        </Grid.RowDefinitions>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Unfocused" />
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Duration="00:00:00.001" Storyboard.TargetName="InnerBorder"
                                                              Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
                                            <SplineColorKeyFrame KeyTime="0" Value="#BF000000" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="00:00:00.3" />
                                    <VisualTransition From="MouseOver" GeneratedDuration="00:00:00" To="Pressed" />
                                    <VisualTransition From="MouseOver" GeneratedDuration="00:00:00.1" To="Normal" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Duration="00:00:00.001" Storyboard.TargetName="Background"
                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Duration="00:00:00.001" Storyboard.TargetName="Highlight"
                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Duration="00:00:00.001" Storyboard.TargetName="Shadow"
                                                              Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                            <SplineColorKeyFrame KeyTime="0"
                                                         Value="#4B000000" />
                                        </ColorAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Duration="00:00:00.001"
                                                               Storyboard.TargetName="Background"
                                                               Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Offset)">
                                            <SplineDoubleKeyFrame KeyTime="0"
                                                          Value=".1" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Duration="00:00:00.001"
                                                              Storyboard.TargetName="Highlight"
                                                              Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                            <SplineColorKeyFrame KeyTime="0"
                                                         Value="#4AFFFFFF" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Duration="00:00:00.001"
                                                               Storyboard.TargetName="Background"
                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="0"
                                                          Value="0.6" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Duration="00:00:00.001"
                                                               Storyboard.TargetName="Background"
                                                               Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Offset)">
                                            <SplineDoubleKeyFrame KeyTime="0"
                                                          Value="0" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Duration="00:00:00.001"
                                                              Storyboard.TargetName="White"
                                                              Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
                                            <SplineColorKeyFrame KeyTime="0"
                                                         Value="#FF000000" />
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Duration="00:00:00.001"
                                                              Storyboard.TargetName="White"
                                                              Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                            <SplineColorKeyFrame KeyTime="0"
                                                         Value="#FFC8C8C8" />
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Duration="00:00:00.001"
                                                              Storyboard.TargetName="Highlight"
                                                              Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                            <SplineColorKeyFrame KeyTime="0"
                                                         Value="#4BFFFFFF" />
                                        </ColorAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Duration="00:00:00.001"
                                                               Storyboard.TargetName="Highlight"
                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="0"
                                                          Value="0.5" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Duration="00:00:00.001"
                                                               Storyboard.TargetName="contentPresenter"
                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="0"
                                                          Value="0.5" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Duration="00:00:00.001"
                                                               Storyboard.TargetName="Background"
                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="0"
                                                          Value="0.2" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Duration="00:00:00.001"
                                                              Storyboard.TargetName="White"
                                                              Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
                                            <SplineColorKeyFrame KeyTime="0"
                                                         Value="#FFB1B1B1" />
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Duration="00:00:00.001"
                                                              Storyboard.TargetName="White"
                                                              Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
                                            <SplineColorKeyFrame KeyTime="0"
                                                         Value="#FFECECEC" />
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Duration="00:00:00.001"
                                                              Storyboard.TargetName="White"
                                                              Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                            <SplineColorKeyFrame KeyTime="0"
                                                         Value="#FFECECEC" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border CornerRadius="4"
                        Grid.RowSpan="2"
                        x:Name="White"
                        BorderBrush="#FFFFFFFF"
                        BorderThickness="1.2">
                            <Border.Background>
                                <RadialGradientBrush>
                                    <RadialGradientBrush.RelativeTransform>
                                        <TransformGroup>
                                            <ScaleTransform CenterX="0.5"
                                                    CenterY="0.5"
                                                    ScaleX="1.35"
                                                    ScaleY="1.35" />
                                        </TransformGroup>
                                    </RadialGradientBrush.RelativeTransform>
                                    <GradientStop Color="#FFFFFFFF"
                                          Offset="0" />
                                    <GradientStop Color="#FFFFFFFF"
                                          Offset="1" />
                                </RadialGradientBrush>
                            </Border.Background>
                        </Border>
                        <Border BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="1.2"
                        CornerRadius="4"
                        x:Name="Background"
                        Grid.RowSpan="2"
                        Opacity="0.65">
                            <Border.Background>
                                <LinearGradientBrush EndPoint="0.5,1.4"
                                             StartPoint="0.5,0">
                                    <GradientStop Color="{StaticResource PrimaryColor}"
                                          Offset="0.75" />
                                    <GradientStop Color="{StaticResource SecondaryColor}"
                                          Offset="1" />
                                </LinearGradientBrush>
                            </Border.Background>
                        </Border>
                        <Border Background="{TemplateBinding Background}"
                        BorderBrush="#7FFFFFFF"
                        BorderThickness="1"
                        CornerRadius="3.5"
                        x:Name="InnerBorder"
                        Margin="1"
                        Grid.RowSpan="2" />
                        <Border CornerRadius="3.5"
                        x:Name="Shadow"
                        Margin="2"
                        Grid.RowSpan="2">
                            <Border.OpacityMask>
                                <RadialGradientBrush>
                                    <RadialGradientBrush.RelativeTransform>
                                        <TransformGroup>
                                            <TranslateTransform X="0"
                                                        Y="-0.5" />
                                        </TransformGroup>
                                    </RadialGradientBrush.RelativeTransform>
                                    <GradientStop Color="#00FFFFFF"
                                          Offset="0.3" />
                                    <GradientStop Color="#FFFFFFFF"
                                          Offset="1" />
                                </RadialGradientBrush>
                            </Border.OpacityMask>
                            <Border.Background>
                                <RadialGradientBrush>
                                    <RadialGradientBrush.RelativeTransform>
                                        <TransformGroup>
                                            <ScaleTransform CenterX="0.5"
                                                    CenterY="0.5"
                                                    ScaleX="1.75"
                                                    ScaleY="2.25" />
                                            <TranslateTransform Y="0.65" />
                                        </TransformGroup>
                                    </RadialGradientBrush.RelativeTransform>
                                    <GradientStop Color="#00000000"
                                          Offset="0.55" />
                                    <GradientStop Color="#33000000"
                                          Offset="1" />
                                </RadialGradientBrush>
                            </Border.Background>
                        </Border>
                        <Border Margin="1,1,1,0"
                        CornerRadius="4,4,40,40"
                        x:Name="Highlight"
                        Opacity="0.8"
                        RenderTransformOrigin="0.5,1">
                            <Border.Background>
                                <RadialGradientBrush>
                                    <RadialGradientBrush.RelativeTransform>
                                        <TransformGroup>
                                            <ScaleTransform CenterX="0.5"
                                                    CenterY="0.5"
                                                    ScaleX="1.25"
                                                    ScaleY="2" />
                                            <TranslateTransform Y="-0.6" />
                                        </TransformGroup>
                                    </RadialGradientBrush.RelativeTransform>
                                    <GradientStop Color="#BFFFFFFF"
                                          Offset="0" />
                                    <GradientStop Color="#4CFFFFFF"
                                          Offset="1" />
                                </RadialGradientBrush>
                            </Border.Background>
                        </Border>
                        <ContentPresenter x:Name="contentPresenter"
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                  Margin="{TemplateBinding Padding}"
                                  RenderTransformOrigin="0.5,0.5"
                                  Grid.RowSpan="2" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</Window.Resources>
<Grid>
    <Button Content="test" Height="50" Width="100"/>
</Grid>