This is a migrated thread and some comments may be shown as answers.

Use ColorAnimation to change the background of RadButton

2 Answers 235 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
Akram
Top achievements
Rank 1
Akram asked on 18 Dec 2012, 08:46 AM
Hi
How to Use ColorAnimation to change the background of RadButton when IsMouseOver is True
, this is my code

<Style TargetType="telerik:RadButton">
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Trigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard >
                                <ColorAnimation From="Green" To="Yellow" Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)"  Duration="00:00:03" RepeatBehavior="Forever"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.EnterActions>
                </Trigger>
            </Style.Triggers>
        </Style>


But is not working.

Thanks,
Akram

2 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 21 Dec 2012, 09:24 AM
Hi Akram,

As far as I understand you need to change the default hover effect of the control. Your snippet in not going to work because the default template triggers/visualStates are applied after the style triggers, hence the trigger becomes overridden. In other words you can not apply two styles at the same time.

In order to customize the default hover state you have to edit the default template of the control. For your convenience I have extracted the template using Blend (as described in this article) in the attached project. Please take a look at it and let me know if it works for you.

Kind regards,
Pavel R. Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Akram
Top achievements
Rank 1
answered on 21 Dec 2012, 01:14 PM
Thanks for your help, but this is a lot of xaml code, i thought there is a simple way to do that.

Thanks,
Akram
Tags
Buttons
Asked by
Akram
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Akram
Top achievements
Rank 1
Share this question
or