Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
Styling a ButtonUIElement
posted

 I am trying to style a ButtonUIElement like this:

 ButtonUIElement elementToAdd = new ButtonUIElement(parent);

elementToAdd.BorderStyle = UIElementBorderStyle.Raised;

but I get a "specificed method is not supported".

I also created a new Appearance object and styled the border and  made the button's appearance use this object but I see no effects.

When I create a new ButtonUIElement, it's a flat grey rectangle. How can I make it look like a real button?

 

  • 469350
    Verified Answer
    Offline posted

    I assume you are adding this element into a control using a CreationFilter. In order to style the button element, what you would have to do is derive your own class from ButtonUIElement and override the InitAppearance method.

    Alternately, you could use a DrawFilter and set the properties on the AppearanceData for your element there.