Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
165
Accessing each cell of a multi-row XamDataGrid
posted

Good Morning 

So I have the following multi-row XamDataGrid. Each Column is an attribute of an external database table. What I need to do is access each cell and extract it in string form in order to save it to the data base. How can I do so?

  • 34810
    Verified Answer
    Offline posted

    Hello Nour,

    In order to access each cell of your XamDataGrid, I would recommend looping through the Records collection of the grid. Each DataRecord in this collection has a Cells collection that you can then use an inner-loop to loop through. Each Cell in this cells collection has a Value property that you can use to get the cell’s values. I am adding a code-snippet below to demonstrate this, where “xdg1” is the XamDataGrid:

                foreach(DataRecord record in xdg1.Records)
                {
                    foreach(Cell cell in record.Cells)
                    {
                        string str = cell.Value.ToString();
                    }
                }

    Please let me know if you have any other questions or concerns on this matter.