question

BitSmithy-4663 avatar image
0 Votes"
BitSmithy-4663 asked NicoZhu-MSFT answered

How to find item from container in UWP DataGrid?

Hello,


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

windows-uwp
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

not exactly sure what you are trying to do here could you explain what you are trying to do better

0 Votes 0 ·

1 Answer

NicoZhu-MSFT avatar image
0 Votes"
NicoZhu-MSFT answered

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.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.