1
Answer

How to retrieve data from datagrid combo box using wpf ?

Ask a question
Hi  actually i am a newbie to the wpf and here i am facing a problem . I unable to retrieve values or data from data grid using a combo box and when ever i am trying to retrieve im getting a error "Object set to an instance"  here is my code please check and help is appreciated


//XAML code :

<DataGridComboBoxColumn Header="packagetype2" TextBinding="{Binding Uom}"  x:Name="cmb_pktype" ></DataGridComboBoxColumn>


//c# code:


DataSet ds1 = uomc.fillcombo();

                cmb_pktype.ItemsSource = ds1.Tables[0].DefaultView;
                cmb_pktype.DisplayMemberPath = ds1.Tables[0].Columns["Name"].ToString();
                cmb_pktype.SelectedValuePath = ds1.Tables[0].Columns["Id"].ToString();



//when i am retrieveing the data like as below 


string type = (dgv_uomconversionmapping.SelectedCells[1].Column.GetCellContent(dgv_uomconversionmapping.Items[i]) as TextBlock).Text;


//This retrieving process is working for data grid textblock column 
 //as this way how can i read the datagrid combobox column

Answers (1)