Friday, December 7, 2012

Loop through selected row in a WPF datagrid

 if (dg.SelectedItems.Count > 0)
            {
                for (int i = 0; i < dg.SelectedItems.Count; i++)
                {
                    System.Data.DataRowView selectedRow = (System.Data.DataRowView)dg.SelectedItems[i];
                    MessageBox.Show( Convert.ToString(selectedRow.Row.ItemArray[2]));
                }
            }

0 comments: