<GridViewColumn Header="Person Age" > <GridViewColumn.CellTemplate> <DataTemplate> <ComboBox Name="mycombo" DataContext="{Binding Tables[person_details]}" Width="100" ItemsSource="{Binding}" SelectedValue="personname" SelectedValuePath="id" DisplayMemberPath="personname"> </ComboBox> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn>
var items = (DataRowView)mylist.Items[i]; ListViewItem myitem = (ListViewItem)(mylist.ItemContainerGenerator.ContainerFromItem(items)); ContentPresenter content = FindVisualChild(myitem, 2); DataTemplate template = content.ContentTemplate; ComboBox mycombo1 = (ComboBox)template.FindName("mycombo", content); con = new SqlConnection(@"Data Source=SPARSH121\SQLEXPRESS;Initial Catalog=vinayaka;User ID=sa;Password=sparsh"); da = new SqlDataAdapter("select personname from person_details", con); ds = new DataSet(); da.Fill(ds); mycombo1.DataContext = ds.Tables[0];
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)