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
255
can controls inherit styleset from parent controls
posted

Hi,

I would like to make several stylesets for different areas in my applicaton so they will look different from each other.

For example I want want my buttons, labels, and textboxes to have a light blue background color in one area of my application.

In a different area, I would like my buttons, labels, and textboxes to have a light green background color.

I would like to make a style set for the blue background color controls and a different styleset for the green background color controls.

If I specifically set the StyleSetName property on each of the controls, I can get the affect I want.

However, i would like to have a panel that all the controls are placed on, and set the StyleSetName property of the panel to the styleset I want to use.

It is my hope that the controls that I placed on the panel will inherit the styleset that I set on the panel. That way I only have to set the styleset once for the panel and not for every control.

Is there a way to do this?

Thanks

Parents
  • 12480
    Verified Answer
    Offline posted

    Hi Harlan,

    This cannot be done automatically. There are two main ways you could solve this:

    1) You could write a routine that would modify the StyleSetName for the parent control and any of its children.
    2) You could extend the Panel class, adding a property that would manage the StyleSetName for each of the children.

    Please let me know if either method works for you.

Reply Children
No Data