Hello
I have a data grid (DG). I want to add a combo box to the data grid(dg). The combo box should immediately be visible in the data grid. So I want to have that with a click the combo box is opened.
So far what I have done.
Dim dtCountry As New DataTable
Dim sQry As String
sQry = "Select COUNTRY_ID, COUNTRY_NAME from ST_country where rec_deleted = 0"
dtCountry = cMain.GetDataTable(sQry)
Dim col As New DataGridTemplateColumn()
Dim fac As New FrameworkElementFactory(GetType(ComboBox))
fac.SetValue(ComboBox.ItemsSourceProperty, dtCountry.DefaultView)
fac.SetValue(ComboBox.DisplayMemberPathProperty, "COUNTRY_NAME")
fac.SetBinding(ComboBox.SelectedValuePathProperty, New Binding("COUNTRY_NAME"))
Dim celli As New DataTemplate()
With celli
.VisualTree = fac
End With
With col
.Header = "Country"
.CellEditingTemplate = celli
.CellTemplate = celli
.SortMemberPath = "COUNTRY_NAME"
End With
DG.Columns.Add(col)
If I selected a country de datagrid wil not be update. And if I start the program I see a datagrid with empty combo boxen.
Please can someone help me.