When using a RadGrid styled with Theme="Expression_Dark" and a GridViewDataColumn with Binding with IValueConverter that simply converts a bool to a text string (of Yes or No) it seems the color of the text is black, not white as the other cells without IValueConverters. See attached capture. This makes it difficult to read.
This consistently happens with two of our grids styled with "Expression_Dark", this occurs with or without our ApplicationTheme set as StyleManager.ApplicationTheme = new Expression_DarkTheme();
On a related note when our ApplicationTheme is set as Expression_DarkTheme our grid styled with Office_Black seem to inherit the Expression_DarkTheme when cells are in edit mode.
Is their a fix or workaround for this?
Can the column/cell theme be forced for edit and display?
Thank you.
7 Answers, 1 is accepted
As it turns out, I was able to reproduce this problem. Unfortunately, I will need a little bit more time to further investigate the case. I will contact you back soon.
As for a workaround, you can try this:
<
telerik:GridViewDataColumn
Header
=
"Is Active"
>
<
telerik:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding IsActive, Converter={StaticResource MyBoolConverter}}"
Foreground
=
"Red"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellTemplate
>
</
telerik:GridViewDataColumn
>
Kind regards,
Yoan
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Thanks for the quick response. Is there any update on this? Since you can reproduce it, can we expect it to be addressed in a future release?
Thanks.
Actually, this is not an issue of RadGridView. What happens is that the ContentControl (that is created when changing the Boolean type to string) does not create a TextBlock when it receives string as content. This behavior is not true for WPF. And since we do not know what is inside ContentControl, we do not have any style prepared for it. What we have is theme for a TextBlock, but since the element in the cell in this case is not a TextBlock, it is not styled.
You can prove that behavior by creating a simple implicit style targeting TextBlock and verify that it is not applied in the elements of the column.
The suggestion provided above is the most appropriate one for handling this scenario.
Let me know in case you have any other problems with the implementation.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
The above suggestion is sufficient for the boolean conversion. What about when our ApplicationTheme is set as Expression_DarkTheme the grid styled with Office_Black seems to inherit the Expression_DarkTheme when cells are in edit mode?
See attached. Is there a way I'm missing to implicitly inherit the grids' theme instead of the application theme when in edit mode?
An example of our EditTemplate is as follows:
<
telerik:GridViewDataColumn.CellEditTemplate
>
<
DataTemplate
>
<
CheckBox
VerticalAlignment
=
"Center"
Margin
=
"5,0,5,0"
IsChecked
=
"{Binding IsDefault, Mode=TwoWay}"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellEditTemplate
>
Thank you,
Patrick
We will investigate the case to verify whether this behavior can be improved. In the meantime, will it be possible to clarify why do you set an application theme as you want the one for the grid to be different ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
We have a few rare instances when we would like to use a different style, so explicitly setting those few makes sense. The RadGridView as Expression_Dark is too dark for our UI, so Office_Black fits the bill nicely. It is inconvenient that the Edit and Display mode of the cells inherit from the application theme instead of the parent RadGrid.
This same issue arose using a GridViewCheckBoxColumn on a RadGridView. Grid was styled Office_Black, the checkbox is styled Expression_Dark (app theme) in both it's Display and Edit modes, which looked bad enough that it was logged as a bug to us developers, which forced us to forgo using, what would be perfectly appropriate, a GridViewCheckBoxColumn in favor of manually adding an explicitly styled checkbox in a custom cell template for a regular GridViewColumn, which dropped some of the nice functionality you've placed in the GridViewCheckBoxColumn.
It would be nice if internal controls inherited the styles from their parents, or even better the ability to specify if you wanted a different theme. Does this make sense?
Thank you,
Patrick
Indeed, you are totally right. I am investigating the issue to verify why some elements do no take the theme from their parent (RadGridView in this case).
I will let you know once I have more information.
Thank you for your patience.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.