10 Answers, 1 is accepted
You can try editing the template of the data form and change the background of the border named "Background_Disabled". Let me know in case this does not lead you to the desired result.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

The problem is that the foreground colors are too light.
The only thing we do when RadDataForm is disabled is to place a Border with different background once IsEnabled property is changed to "false". So, changing it should do the trick. Will it be possible to clarify which theme you are working with ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

"Will it be possible to clarify which theme you are working with ?"
All of them. Or rather, our application allows the user to select which theme to use.
But all of the provided themes show this problem.
The theme with the lightest elements in disabled state is most probably Windows8Theme. I have tested the case and if the Background in disabled state is set to Transparent, all elements of the DataForm look ok. Still, all editing controls are in disabled state as well. Do you refer to them when saying the data form is not readable ? If that is the case, you will need to change their disabled states as well.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Currently, I'm setting the Background_Disabled border to transparent with:
void
myForm_Loaded(
object
sender, RoutedEventArgs e)
{
foreach
(Border border
in
this
.ChildrenOfType<Border>())
{
if
(border.Name ==
"Background_Disabled"
)
border.Background = Brushes.Transparent;
}
}
But I've been unable make this work in setting the foreground colors of the controls on the form.
This, for example:
foreach
(FrameworkElement element
in
this
.ChildrenOfType<FrameworkElement>())
{
PropertyInfo foregroundProperty = element.GetType().GetProperty(
"Foreground"
);
if
(foregroundProperty !=
null
)
foregroundProperty.SetValue(element, Brushes.Red,
null
);
}
will successfully set the foreground color of every control on my form to red, when the form is opened in edit mode, but when the form is disabled, the labels stay red, but the foreground colors of all of the regular controls (textboxes, checkboxes, dropdowns, etc.) turn light gray.
I tested the case, but I was not able to reproduce the behavior where the editors do not get the Red foreground. I am attaching the project I used for the test. Is there something that I am missing ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Two complexities in my code that I hadn't thought were relevant, but which seem to be:
- The fields in my forms have explicit content set, rather than the one that they would generate themselves by default.
- Rather than auto-generating the fields, the forms have templates set - and - those templates are from an external source, and are not part of the application.
In my app, the form templates are loaded from external files, and are constructed using XamlReader.Load(). But it doesn't look like it's the external loading that is the problem.
Starting with your example:
First: I created a DataTemplate that defined three DataFormDataFields, in Windows.Resources.
And I bound the form's ReadOnlyTemplate to that DataTemplate.
And the foreground colors changed as desired.
Second: I modified one the Name field in the template to use an explicit TextBox, instead of the auto-generated control.
And the foreground colors still changed as desired. Even in the explicit TextBox.
Third: I removed the form's ReadOnlyTemplate binding, and set ReadOnlyTemplate in MainWindow_Loaded()
And then, finally, I did not see the foreground color change, in the explicit TextBox.
The attachment mechanism in this forum will not allow .zip files, so I created a support ticket: 657307 to which I've attached a zip file containing this third example.
Thank you for the project.
In your case, when the Foreground property is set the content of DataFormDataField is still not changed. Following code will resolve the problem:
private
void
officeBlackDataForm_Loaded(
object
sender, RoutedEventArgs e)
{
foreach
(Border border
in
this
.ChildrenOfType<Border>())
{
if
(border.Name ==
"Background_Disabled"
)
border.Background = Brushes.Transparent;
}
Dispatcher.BeginInvoke(
new
Action(() =>
{
foreach
(FrameworkElement element
in
this
.ChildrenOfType<FrameworkElement>())
{
PropertyInfo foregroundProperty = element.GetType().GetProperty(
"Foreground"
);
if
(foregroundProperty !=
null
)
foregroundProperty.SetValue(element, Brushes.Red,
null
);
}
}));
}
Greetings,
Yordanka
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Thanks for your help.