How to find item from container in UWP DataGrid?

BitSmithy 1,256 Reputation points
2021-03-26T21:01:25.323+00:00

Hello,

In UWP DataGrid I have DataGridRow.
How to get Item attached to this DataGridRow?

Universal Windows Platform (UWP)
{count} votes

1 answer

Sort by: Most helpful
  1. 2021-03-29T02:44:18.94+00:00

    Hello, Welcome to Micorosoft Q&A,

    How to get Item attached to this DataGridRow?

    For your scenario, you could get DataGridRow from LoadingRow event then get the row from DataGridRowEventArgs. If you want to get attached item, you could get item with row DataContext like the following.

    private void MyDataGrid_LoadingRow(object sender, DataGridRowEventArgs e)  
    {  
        var row = e.Row;  
        var item = row.DataContext;  
    }  
    

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    No comments