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

RadRibbonBar/ RadImageButtonElement

1 Answer 48 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Sameh
Top achievements
Rank 1
Sameh asked on 30 Mar 2008, 10:46 AM

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...

1 Answer, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 01 Apr 2008, 12:26 PM
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
Tags
RibbonBar
Asked by
Sameh
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Share this question
or