开发者

Why does applying this gradient style break my silverlight app?

I am having some issues with applying a gradient to a RadButton.

I have开发者_JS百科 a gradient definition in my styles resource dictionairy like so :

 <LinearGradientBrush x:Key="GridView_HeaderBackground" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FF5B5B5B" Offset="1"/>
    <GradientStop Color="#FF868686"/>
    <GradientStop Color="#FF4F4F4F" Offset="0.42"/>
    <GradientStop Color="#FF0E0E0E" Offset="0.43"/>
</LinearGradientBrush>

When i apply this gradient directly to the background of a RadButton everything works. Here is the button and the template definition:

Button

<telerik:RadButton Margin="5,10,5,0"  Click="RadButton_Click" Tag="30" Content="30 Days" Style="{StaticResource SliderButton}" Background="{StaticResource GridView_HeaderBackground}"  />

Template:

 <!-- Style Template for Slider RadButton -->
<Style x:Key="SliderButton" TargetType="telerik:RadButton">

    <Setter Property="Height" Value="30" />
    <Setter Property="Foreground" Value="#FFFFFF" />
    <Setter Property="BorderThickness" Value="0" />
    <Setter Property="Margin" Value="5,2" />
</Style>

However when applying this gradient in the resource dictionary, my application will not load it simply gets to the silverlight loading screen and then never proceeds

Here is the button and template which breaks my app.

Button:

<telerik:RadButton Margin="5,10,5,0"  Click="RadButton_Click" Tag="30" Content="30 Days" Style="{StaticResource SliderButton}" />

Template:

 <!-- Style Template for Slider RadButton -->
    <Style x:Key="SliderButton" TargetType="telerik:RadButton">
        <Setter Property="Background" Value="{StaticResource GridView_HeaderBackground}" />
        <Setter Property="Height" Value="30" />
        <Setter Property="Foreground" Value="#FFFFFF" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Margin" Value="5,2" />
    </Style>

When i observe the js error console in google chrome i notice the following error is produced:

"Cannot find a resource with the name/key ResourceWrapper"


The "GridView_HeaderBackground" needs to be defined before "SliderButton". If they are in the same Xaml then that is determined by document order.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜