failed to operate on a disabled WPF grid cell RRS feed

  • Question

  • I have a method to get a grid cell value through its row and column index like as below. The problem is it cannot operate on a DISABLED WPF grid cell. Anyone has the same concern?

           // get cell value

            public string GetCellValue(WpfTable wpfTable, int rowIndex, int columnIndex)


                // get the cell 

                WpfRow wpfRow = wpfTable.Rows[rowIndex] as WpfRow;

                WpfCell wpfCell = wpfRow.Cells[columnIndex] as WpfCell;


                // get the cell edit text

                UITestControlCollection cellChildren = wpfCell.GetChildren();

                UITestControl cellControl = cellChildren[0];


                // handle different type of cell control

                if (cellControl is WpfEdit)


                    WpfEdit wpfEdit = cellControl as WpfEdit;

                    return wpfEdit.Text;


                else if (cellControl is WpfComboBox)


                    WpfComboBox wpfCombo = cellControl as WpfComboBox;

                    return wpfCombo.SelectedItem;




                    throw new Exception("unknwon type of cell control found");




    totta wang
    Friday, February 18, 2011 9:18 AM

All replies

  • What is the exception you are getting?
    Please mark this post as answer if this answers your question
    Monday, February 21, 2011 3:28 AM