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

[Solved] Row selection on RadDataGrid

7 Answers 242 Views
Grid for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mag
Top achievements
Rank 2
Mag asked on 16 Jan 2014, 10:37 PM
Hello
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

Sort by
0
Accepted
Rosy Topchiyska
Telerik team
answered on 17 Jan 2014, 01:02 PM
Hello Mario,

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.

0
Mag
Top achievements
Rank 2
answered on 17 Jan 2014, 01:15 PM
Can i change the background of the selected item??
How do i do that?
0
Rosy Topchiyska
Telerik team
answered on 17 Jan 2014, 04:51 PM
Hello Mario,

There are two ways to change the background of the selected items:
  1. Via Implicit Styling - see the SelectionRegionBackground Control section. This will change the style only for the current grid instance.
  2. 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.
I hope this was useful.

Regards,
Rositsa Topchiyska
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Doug
Top achievements
Rank 1
answered on 17 Jan 2014, 09:32 PM
On a related note, how do you change the foreground color on a selected row?  Everything I have tried seems to change all the rows selected and unselected.

0
Rosy Topchiyska
Telerik team
answered on 21 Jan 2014, 03:06 PM

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.

0
Doug
Top achievements
Rank 1
answered on 28 Jan 2014, 03:02 PM
Thank you Rositsa,

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.



0
Rosy Topchiyska
Telerik team
answered on 31 Jan 2014, 12:56 PM
Hi Doug,

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>
Where
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).

Tags
Grid for XAML
Asked by
Mag
Top achievements
Rank 2
Answers by
Rosy Topchiyska
Telerik team
Mag
Top achievements
Rank 2
Doug
Top achievements
Rank 1
Share this question
or