Changing Background_Disabled color?

5 posts, 1 answers
  1. Jeff
    Jeff avatar
    64 posts
    Member since:
    Dec 2011

    Posted 22 Mar 2012 Link to this post

    I'm trying to change the color of a RadDataForm, when it's disabled.

    I've found these instructions: http://www.telerik.com/help/wpf/raddatafor-styles-and-templates-styling-raddataform.html

    But when I load my solution file in Microsoft Expression Blend 4, I get exceptions:

    XamlParseException: 'Office_Black' is not a valid value for property 'Theme'.
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 23 Mar 2012 Link to this post

    Hi Jeff,

    I have tested such scenario with 2012.1 215, by extracting its template. I have not encountered neither design-time, nor run-time errors. Would you please confirm which version of RadControls you are currently using?

    Kind regards,
    Ivan Ivanov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Jeff
    Jeff avatar
    64 posts
    Member since:
    Dec 2011

    Posted 23 Mar 2012 Link to this post

    I tried it in a simple test project, and had no troubles.  I'm not certain, at this time, what the problem is in my production project.

    Is there a way of just setting the Background_Disabled brush, without copying 100+ lines of style definition?  It's not just that I don't want to change any of it, I want to keep what's being defined on the higher level.

    In truth, I don't want to copy and edit the default style, I want to inherit from it and change just the one value I am interested in.

    I mean, if someone changes the application theme the default style will change, except for the controls that I've applied my copied style to.  And I don't want that.  I just want the Background_Disabled to be different, on a certain set of RadDataForms, regardless of what theme is set.
  5. Answer
    Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 26 Mar 2012 Link to this post

    Hi Jeff,

    Currently there are two options to achieve this. The first one is to predefine the template and the second one - to find the element in the visual tree at run-time and set its background property. That is how the framework works and unfortunately it is impossible for us to expose every single brush through a property, as this will severely damage our API's usability. However, with Q1 SP, we will introduce an implicit-style-based theming mechanism that would make the things easier in your scenario, because you would have direct access to the resources.

    All the best,
    Ivan Ivanov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. Jeff
    Jeff avatar
    64 posts
    Member since:
    Dec 2011

    Posted 26 Mar 2012 Link to this post

    This is working:
    foreach (Border border in myControl.ChildrenOfType<Border>())
    {
        if (border.Name == "Background_Disabled")
            border.Background = Brushes.Transparent;
    }
    Thanks.
Back to Top
UI for WPF is Visual Studio 2017 Ready