RadRibbonBar/ RadImageButtonElement

2 posts, 0 answers
  1. Sameh
    Sameh avatar
    4 posts
    Member since:
    Jan 2008

    Posted 30 Mar 2008 Link to this post

    I'm having a problem in changing the image of the RadImageButtonElement,
    after I change the Image property in this element by code, when the mouse raise the ImageHovered or ImageClicked event, the Image of the Button returns to a previous image.

    How can I fix this problem ?

    Regards...

  2. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 01 Apr 2008 Link to this post

    Hi Sameh,

    Thank you for writing.

    I have managed to reproduce this issue locally. We will address it in one of the our upcoming releases. Currently, you could workaround it by removing the RadImageButtonElement, recreating it with new image and adding it again.

    Please review the code-block provided below: 

    private RadImageButtonElement CreateImageButton(Image image)  
    {  
        RadImageButtonElement imgButton = new RadImageButtonElement();  
        imgButton.TextImageRelation = TextImageRelation.ImageBeforeText;  
        imgButton.Text = "ImageButton";  
        imgButton.DisplayStyle = Telerik.WinControls.DisplayStyle.ImageAndText;  
        imgButton.Image = image;  
        imgButton.ImageHovered = RadRibbonBarTest.Properties.Resources.help;  
     
        return imgButton;  
    }  
     
    private void ChangeImageInButton(Image newImage)  
    {  
        int index = this.radRibbonBarChunk1.Items.IndexOf(radImageButtonElement1);  
        this.radRibbonBarChunk1.Items.Remove(radImageButtonElement1);  
        radImageButtonElement1 = CreateImageButton(newImage);  
        this.radRibbonBarChunk1.Items.Insert(index, radImageButtonElement1);  

    I hope this was helpful. If you have other questions, do not hesitate to contact me again.

    Greetings,
    Martin Vasilev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top