RadSplitButton ignores BackgroundImage property

3 posts, 2 answers
  1. Christian
    Christian avatar
    12 posts
    Member since:
    Sep 2014

    Posted 22 Sep 2014 Link to this post

    I need to display a tiled image as BackgroundImage in a RadSplitButton, but when I set the BackgroundImage property it is ignored by the control

    In the other hand, the Image property works as normally, but I need to set the BackgroundImage property.

    Why this property is ignored by default, and how to fix it?.

    Ive discussed this in other site ( http://stackoverflow.com/questions/25869595/telerik-radsplitbutton-ignores-backgroundimage-property );
    and the suggested solution was:
    'In order to show the button background image you have to hide its fill',
    but doing that the button looses the applied theme.

    Following the suggested solution there, the person who helped me said one more thing:
    "It is a fact that to see a background image you have to give some transparency to the top layer and this is why you loose the Theme. So rather sort out the image dimensions before using it as image for the control and use "Image" instead of backgroundImage."

    ...But I can't understand that because:
    "A normal Image property is drawn over the top-layer so why suppose a big problem to do the same as default with a BackgroundImage?,
    if you notice it a default .NET framework control (eg: a Button) can manage a BackgroundImage without loosing the theme then this issue with Teleirk controls for me is a  little bit strange."

    Thanks in advance.
  2. Answer
    Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 23 Sep 2014 Link to this post

    Hi Christian,

    Thank you for writing.

    RadSplitButton is in fact built of three different elements - action button, separator and arrow button. Each of these elements is built of other elements (fills, borders, etc). All controls in our suite is built with the Telerik Presenation Framework and consist of multiple elements to allow greater flexibility. This way for example you can set different image/color for different elements. 

    In this case, the BackgroundImage is painted on the control, however, the element's fills are painted over it, hence it is not visible. Here is how to hide the fills in order to see the BackgroundImage:
    radSplitButton1.DropDownButtonElement.ActionButton.ButtonFillElement.Visibility = ElementVisibility.Collapsed;
    radSplitButton1.DropDownButtonElement.ArrowButton.Fill.Visibility = ElementVisibility.Collapsed;
    radSplitButton1.DropDownButtonElement.ButtonSeparator.DrawBorder = false;

    I see that you also want to see the theme. This however, would not be possible as you cannot see both the image and the fill, as if you see the fill, the image is hidden. Perhaps you can use the MouseEnter and MouseLeave event to apply different image for hover?

    Let me know if I can be of further assistance with this case.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Answer
    Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 23 Sep 2014 Link to this post

    Hi Christian,

    Thank you for writing.

    RadSplitButton is in fact built of three different elements - action button, separator and arrow button. Each of these elements is built of other elements (fills, borders, etc). All controls in our suite is built with the Telerik Presenation Framework and consist of multiple elements to allow greater flexibility. This way for example you can set different image/color for different elements. 

    In this case, the BackgroundImage is painted on the control, however, the element's fills are painted over it, hence it is not visible. Here is how to hide the fills in order to see the BackgroundImage:
    radSplitButton1.DropDownButtonElement.ActionButton.ButtonFillElement.Visibility = ElementVisibility.Collapsed;
    radSplitButton1.DropDownButtonElement.ArrowButton.Fill.Visibility = ElementVisibility.Collapsed;
    radSplitButton1.DropDownButtonElement.ButtonSeparator.DrawBorder = false;

    I see that you also want to see the theme. This however, would not be possible as you cannot see both the image and the fill, as if you see the fill, the image is hidden. Perhaps you can use the MouseEnter and MouseLeave event to apply different image for hover?

    Let me know if I can be of further assistance with this case.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top