New to Telerik Test Studio Dev EditionStart a free 30-day trial

Go Through Each Cell in a WPF RadGridView

I would like to go through each cell in a WPF RadGridView and perform some action or verification.

Solution

This is possible with a coded solution. Here's an example that goes through all the visible cells in a WPF demo grid (as opposed to all the cells contained in the grid). It writes the text content of each cell into the test log.

C#
    WpfApplication app = Manager.ActiveApplication;
    Assert.IsNotNull(app);
    
    Telerik.WebAii.Controls.Xaml.Wpf.RadGridView grid = app.MainWindow.Find.ByName<Telerik.WebAii.Controls.Xaml.Wpf.RadGridView>("RadGridView1");
    Assert.IsNotNull(grid);
    
    int rowCounter = 1;
    
    foreach (Telerik.WebAii.Controls.Xaml.Wpf.GridViewRow gRow in grid.Rows)
    {
        Log.WriteLine("<----------Start of Row " + rowCounter.ToString() + "---------->");
        
        int cellCounter = 1;
        foreach (Telerik.WebAii.Controls.Xaml.Wpf.GridViewCell gCell in gRow.Cells)
        {
            Log.WriteLine(gCell.TextBlockContent);
            cellCounter++;
        }
        rowCounter++;
    }
In this article
Solution
Not finding the help you need?
Contact Support