5 Answers, 1 is accepted
Please see the following thread and let me know if this works in your scenario.
Greetings,
Vanya Pavlova
the Telerik team
Let's just say my code looks like this:
public void ProcessCells() { RadGridView grid = GetGrid(); GridViewRow row = // ??? how do I get this from the grid in order to do the following? foreach (GridViewCell cell in row.Cells) { if ( cell.Column.UniqueName = "Value") { //Process Cell } } }How do I get the rows collection, and thus the cells collection, from the grid itself?
I wouldn't recommend you to work with UI element but with the data itself. For example, you can use the Items property of RadGridView to go through all items, cast each one to the correct type and process the item by inspecting its properties.
foreach (Player player in this.playersGrid.Items) { if (player.Country == "") { // do something } }How does that sound?
All the best,
Milan
the Telerik team
You can use our ChildrenOfType<T>() extension method to get cells on the screen however working in this way next time when you scroll these cells may not exists or with be associated with different rows/columns. The grid is virtual with container recycling. The standard way in both Silverlight and WPF is MVVM - no matter if you want to consume data or not you will need to bind the controls to your model where you can separate your business logic, listen for commands and values changes.
Regards,Vlad
the Telerik team
