RadButtonElement Image

4 posts, 0 answers
  1. Mercell
    Mercell avatar
    33 posts
    Member since:
    Nov 2006

    Posted 10 May 2007 Link to this post

    Hi!

    Just updated to RadControls Q1 2007 and now I can't remove an image from a RadButtonElement.

    I have a RadPanelBarGroupElement with two RadButtonElements. When I click on a RadButtonElement I wan't to set an image on this element and clear it from the other. Setting the Image property to null hasn't any effect. The image is still shown on the element. This worked fine in Q4 2006.

    Here is my code:
            private void radButtonElement1_Click(object sender, EventArgs e)  
            {  
                radButtonElement1.Image = Resources.MyImage;  
                radButtonElement2.Image = null;  
            }  
     
            private void radButtonElement2_Click(object sender, EventArgs e)  
            {  
                radButtonElement2.Image = Resources.MyImage;  
                radButtonElement1.Image = null;  
            }  
     

    How can I remove an image from a RadButtonElement?

    Thanks!
  2. Boyko Markov
    Admin
    Boyko Markov avatar
    610 posts

    Posted 10 May 2007 Link to this post

    Hi Bo Jørgensen,

    You could set or remove an image to the RadButtonElement by using its Image, ImageKey or ImageIndex properties.

    Another solution is to collapse the ImagePrimitive of the RadButtonElement by changing its Visibility property. You could achieve this doing the following:

        (radButtonElement.Children[1].Children[0] as ImagePrimitive).Visibility = Telerik.WinControls.ElementVisibility.Collapsed; 
     

    You could also set the DisplayStyle property of RadButtonElement to be a text only.

    I hope this helps.

    Greetings,
    Ray
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Mercell
    Mercell avatar
    33 posts
    Member since:
    Nov 2006

    Posted 11 May 2007 Link to this post

    Hi Ray

    That's exactly what I'm trying to do if you look at my code. I set the Image property to null but that doesn't remove the image.

    The exact same code works fine with the Q4 2006 version of the controls so something may have changed.

    Thanks

  5. Boyko Markov
    Admin
    Boyko Markov avatar
    610 posts

    Posted 11 May 2007 Link to this post

    I am not sure how this simple bug made it in the official release. I confirm that the Image property does not remove the image if set to null. We will investigate the faulty behavior and will fix it for one of the upcoming releases.

    At present you could set the displayStyle property of RadButtonElement  or change the visibility property of RadButtonElement's ImagePrimitive.


    Sincerely yours,
    Ray
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top