How to change color of a cell when user clicks on it, to user defined color.

1 Answer 67 Views
DataGrid
Tony
Top achievements
Rank 1
Iron
Tony asked on 16 Aug 2024, 02:57 PM

I'm using the .net Maui RadDataGrid.

In my case the user needs to color code several cells inside of the grid.  The user will select a color then click on the cell.  I need to be able to change the color of that cell.  How do find that cell and change the color at runtime?  One cell will be changed to red, then the next one could be blue.

1 Answer, 1 is accepted

Sort by
0
Didi
Telerik team
answered on 19 Aug 2024, 12:44 PM

Hi Tony,

Thank you for the provided details. 

Based on your question, if I understood correctly, you want to dynamically change the color of the cell. However, the DataGrid does not provide bindings in the cell color properties. We have this logged here: https://feedback.telerik.com/maui/1570690-datagrid-provide-support-for-property-binding-in-datagridborderstyle-and-datagridcellstyle-class 

Styling options:

If you want to style the current cell, you can use the CurrentCellStyle property. I have updated the docs here: https://docs.telerik.com/devtools/maui/controls/datagrid/cells/current-cell and the updates should be live soon. The example can be found here: https://github.com/telerik/maui-samples/blob/main/Samples/SdkBrowser/Examples/DataGridControl/KeyboadNavigationCategory/KeyboardNavigationExample/KeyboardNavigation.xaml 

Styling the cell/row is described here: https://docs.telerik.com/devtools/maui/controls/datagrid/theming-and-styles/styling#cells-and-rows 

Styling the text in the cell on hover: https://docs.telerik.com/devtools/maui/controls/datagrid/theming-and-styles/styling#text-on-hover 

Styling the header: https://docs.telerik.com/devtools/maui/controls/datagrid/theming-and-styles/columns-styling#header-styling 

All styling options are described in the styling section of the DataGrid docs

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
DataGrid
Asked by
Tony
Top achievements
Rank 1
Iron
Answers by
Didi
Telerik team
Share this question
or