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

requirement to change the image of the radbutton to different image on 'Hover' operation

1 Answer 88 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
Srinivas
Top achievements
Rank 1
Srinivas asked on 20 Sep 2010, 04:28 PM


Hello Telerik,
I am developing a customcontrol for radbutton .


I have a requirement to change the image of the radbutton to different image on 'Hover' operation.

public

 

 

class TngButton : TngBaseTemplateControl

 

 

 

{

 


 

 

static TngButton()

 

{

DefaultStyleKeyProperty.OverrideMetadata(

 

 

 

typeof(TngButton), new FrameworkPropertyMetadata(typeof(TngButton)));

 

}

 

 

#endregion

 

 

public override void OnApplyTemplate()

 

{

 

 

 

 

base.OnApplyTemplate();

 

 

 

 

 

RadButton btn = this.Template.FindName("PART_BaseControl", this) as RadButton;

 

 

 

 

 

ContentPresenter content = this.Template.FindName("PART_ContentControl", this) as ContentPresenter;

 

 

 

 

 

btn.Hover+=new EventHandler<Telerik.Windows.RadRoutedEventArgs>(btn_Hover);

 

 

}

 

 

 

 

 

void btn_Hover(object sender, EventArgs e)

 

{

 

 

 

 

 

// code to change the image at the hover .

 

 

 

 

 

 

}


i want to have two properties like 'originalimage' and 'hoverimage" which can be changed on mover hover action
can you help me in how to setting the logic for this ?

regards,
Srinivas

 

 

1 Answer, 1 is accepted

Sort by
0
Viktor Tsvetkov
Telerik team
answered on 21 Sep 2010, 11:35 AM
Hello Srinivas,

One possible approach is to attach to MouseEnter and MouseLeave events and there to manage your hovered-unhovered logic. You can examine the attached sample and if you have further questions feel free to ask.

Regards,
Viktor Tsvetkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Buttons
Asked by
Srinivas
Top achievements
Rank 1
Answers by
Viktor Tsvetkov
Telerik team
Share this question
or