This is a migrated thread and some comments may be shown as answers.

Changing Background_Disabled color?

4 Answers 82 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 22 Mar 2012, 10:00 PM
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'.

4 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 23 Mar 2012, 11:04 AM
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 >>
0
Jeff
Top achievements
Rank 1
answered on 23 Mar 2012, 04:11 PM
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.
0
Accepted
Ivan Ivanov
Telerik team
answered on 26 Mar 2012, 01:01 PM
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 >>
0
Jeff
Top achievements
Rank 1
answered on 26 Mar 2012, 03:58 PM
This is working:
foreach (Border border in myControl.ChildrenOfType<Border>())
{
    if (border.Name == "Background_Disabled")
        border.Background = Brushes.Transparent;
}
Thanks.
Tags
DataForm
Asked by
Jeff
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Jeff
Top achievements
Rank 1
Share this question
or