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

2 posts, 0 answers
  1. Srinivas
    Srinivas avatar
    32 posts
    Member since:
    Aug 2010

    Posted 20 Sep 2010 Link to this post



    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

     

     

  2. Viktor Tsvetkov
    Admin
    Viktor Tsvetkov avatar
    382 posts

    Posted 21 Sep 2010 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top