KB Article AK9476
Visible to All Users

How to get colors that correspond to the currently used skin

Description:
I'm using the XtraGrid and handle its RowCellStyle event for conditional cell highlighting. Currently, a fixed (constant) color is assigned to the cell's background. I'd rather want to use colors, which match the currently used appearance theme, which is set in the DefaultLookAndFeel control. Please note that end-users of my application can select one of the available skins that they prefer.

Answer:
There are two solutions to your task.

  1. You can try to "translate" a standard system color to the corresponding replacement color, defined in our skin:
    How to convert a standard color to a color which corresponds to the current skin
  2. Use the color of a particular control's element for cell highlighting:
    How to obtain the color of a particular control's element when skins are used
    To find a skin element with an appropriate color, please launch the SkinEditor tool, create a new skin project and look for the necessary element in the tree view.
    Please note that most skin elements are painted via images, i.e. a picture defined in the skin assembly is stretched to fill the entire element's boundaries. When you decide to use the second solution listed above, ensure to select the skin element with the BackColor assigned (non-Empty). As for the first solution, please keep in mind that not all system colors are re-defined in a given skin. Here is a screenshot of the SkinEditor. It shows where to look for the skin specific colors.

    See Also:
    How to get skin images at runtime

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.