How to get some properties from theme

2 posts, 0 answers
  1. Veljko Janjic
    Veljko Janjic avatar
    20 posts
    Member since:
    Nov 2005

    Posted 14 Jan 2008 Link to this post

    Is there a way to read some properties of selected theme (e.g background color of selected cells or any other property)?

    Thanks in advance
  2. Mike
    Admin
    Mike avatar
    640 posts

    Posted 15 Jan 2008 Link to this post

    Hello Veljko Janjic,

    Thank you for contacting us.

    Even though all property settings are available through the StyleSheet object, it would be really hard to process the complex structure and find the needed property values.

    The main issue comes form the fact that themes define property values for various states of different elements. For example, GridViewCell elements have different appearance depending on the value of IsCurrent and IsSelected properties.

    There is also property-value inheritance mechanism, similar to Control's ambient properties. This means an element may have a different background color depending on its parent's style. Another problem is that the appearance of an element is formed by a number of properties which should be respected in order to have correct results.

    If you need information about the runtime appearance properties (unlike the toolbox toolstrip for example), elements of RadControls, use the actual property values for painting. That's why, the simpler solution would be to check the values of different properties of RadGridView at runtime, similar to the approach of RadControlSpy.

    Another solution is to simulate grid elements and use style API to apply style over these template objects - grid cells and rows, which can be used to check the resulting property values. We have prepared an application that demonstrates this approach.

    Please, if you have any questions, do not hesitate to write.

    Sincerely yours,
    Mike
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top