I am using data table for populating data through Radgridview control instead of direct collection and facing some issue with this control which is not able to get all the cell value from this control. In my project is using through code behind.
Current Telerik version : v4. 0. 30319
Thanks & Regards
Murugansilvers
2 Answers, 1 is accepted
Hello MuruganSilvers,
If I understand your issue correctly, you want to see the cells' background color updated based on a condition. To achieve the wanted behavior you could create a custom CellStyleSelector class. The following documentation contains detailed steps on how to create one:
WPF DataGrid | CellStyleSelector | Telerik UI for WPF
You could look at this documentation that explains the UI Virtualization and how we use it in the RadGridView control:
WPF DataGrid | UI Virtualization | Telerik UI for WPF
Another point to consider is that it is not recommended to work with the visual elements of RadGridView(GridViewCell, GridViewRow, etc.) directly, as in your case to alter their Background property. This may result in inconsistent behavior due to the containers' recycling mechanism such as the one you observe while scrolling. Instead, you should use the underlying data items as explained in the Style Selectors section.
Also, I am attaching an example project regarding the mentioned StyleSelector class for your reference.
Regards,
Stenly
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Thanks for your support. I applied style in codebehind now it's working.
Thanks & Regards
Murugan M
Hello MuruganSilvers,
The issue is that RadGridView uses UI virtualization which ensures that only the visible rows of a container are rendered on the screen.That is why you can't get all the cells from the control. You could still access them through the DataTable as follows:
var dataRows = this.MyDataTable.Rows;
Regards,
Stenly
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
I understood the issue on Radgridview but I need to update the cell background color whenever scroll horizontal bar or vertical bar. If have any possible ways to achieve this, please help me out from this.
Thanks & Regards
Murugansilvers M
Hi MuruganSilvers,
Could you please explain the wanted behavior a bit more? Also could you see the following documentation about styling cells based on certain conditions:
I want change background color in Radgridview cell based on some condition, that's why I need to take all the cells then only update background color. I didn't use direction collection and using grouping in Rradgridview control. How to update background color in Radgridview cell whenever scrolling horizontal and vertical bar.
Thanks & Regards
Murugansilvers M