I have a RadDataGrid to show some information, but when i select a row, i can't see the information.
On the attach file you can see my problem, can you help me
Sorry for my basic English
7 Answers, 1 is accepted
Thank you for contacting us.
You can not see the information because you have set the background of the selected item to be the same as the foreground of the grid cells.
I hope this was useful.
Regards,
Rositsa Topchiyska
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
How do i do that?
There are two ways to change the background of the selected items:
- Via Implicit Styling - see the SelectionRegionBackground Control section. This will change the style only for the current grid instance.
- Using the Telerik named brushes - this will change the style of the selected grid item globally in your application. To see how to use the Telerik brushes, you can read these articles from our online documentation in the order they are listed: Please, note that the Telerik named resources are resolved differently in Windows 8 and 8.1 versions of the controls.
Regards,
Rositsa Topchiyska
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Hi Doug,
Thank you for the question.
Unfortunately, the current version of the grid does not provide an easy way to change the foreground of the selected item. I have redirected your request to our development team for future consideration.
As a workaround you can use the CellContentStyleSelector property of the grid columns. You can add an IsSelected property to your data items and update it every time an item is selected/unselected. Then use the CellContentStyleSelector property and create a custom class that inherits from the StyleSelector class. Then override the SelectStyleCore(...) method and check the value of the IsSelected property and return the appropriate style. I have attached a sample application that demonstrates how to do this.
I hope this was useful. Please, let us know if you have further questions.
Regards,Rositsa Topchiyska
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
There is one more question I have with styling that I haven't been to find. We set the grid's background to transparent with the text a dark gray in the unselected state. For the selected state we have the row's background flip to the dark gray with the text white. However we have notice there is a third state, a focus state, if you will that returns the row back to the default black background with a white foreground. How do we style that?
Thanks again.
Thank you for contacting us.
The third state that you have observed is the "current item" state. This can be styled by adding an implicit style to the RadDataGrid.Resources the same way you style the SelectionRegionBackgroundControl:
<telerikGrid:RadDataGrid.Resources> <Style TargetType="gridPrimitives:DataGridCurrencyControl"> <Setter Property="Background" Value="Blue"/> </Style></telerikGrid:RadDataGrid.Resources>xmlns:gridPrimitives="using:Telerik.UI.Xaml.Controls.Grid.Primitives"Unfortunately, the RadDataGrid does not provide an easy way to change the foreground of the current item. You can either set the Background of the DataGridCurrencyControl to Transparent and the user will not be aware of the third state, or just use the default Foreground for not selected items.
I hope this helps. Please, let us know if this fulfills your requirements.
Regards,
Rositsa Topchiyska
Telerik
Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).