Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Get Row from Microsoft.Windows.Controls.DataGrid

$
0
0
Hi,
I want to access the elements in the DataGrid.I am using following code.But I am unable to get the row of DataGrid.I am getting null value.I just want to know why I am getting null value and how to resolve this issue.

     int itemscount = (dgMtHdr.Items.Count);
                    dgMtHdr.UpdateLayout();
                    for (int rowidx = 0; rowidx < itemscount; rowidx++)
                    {
    
                        Microsoft.Windows.Controls.DataGridRow dgrow = (Microsoft.Windows.Controls.DataGridRow)this.dgMtHdr.ItemContainerGenerator.ContainerFromIndex(rowidx);
                       
                        if (dgrow != null)
                        {
                            DataRow dr = ((DataRowView)dgrow.Item).Row;
                            if (dr != null)
                            {
                               
                                    obj = new WPFDataGrid();
                                    Microsoft.Windows.Controls.DataGridCell cells = obj.GetCell(dgMtHdr, rowidx, 7);
                                    if (cells != null)
                                    {
                                        ContentPresenter panel = cells.Content as ContentPresenter;
                                        if (panel != null)
                                        {
                                            ComboBox cmb = obj.GetVisualChild<ComboBox>(panel);
    }
       }
       }
    }
      }

cas


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>