wpf - Datagrid ComboBox Binding -
i have table in database represents list of areas. of these items in list , bind them combobox dropdown in datagrid. works, , grid column displays dropdown. however, when select item in cell , move next row, cell becomes blank. also, if entry in database has saved value of "area1", , dropdown list has "area1,area2,area3,etc", when grid loads, doesn't autoselect area1, cell blank.
in model:
comboboxcolumn1.itemssource = ctx.areas;//db context loading areas combobox
in xaml:
<datagrid.columns> <datagridcomboboxcolumn displaymemberpath="name" header="some header" x:name="comboboxcolumn1" selectedvaluebinding="{binding name}" /> ....
how go setting selected value equal whatever entry in db?
you need set selectedvaluepath
value variable property. displaymemberpath
shown, , selectedvaluepath
selected. selecteditem
actual item selected.
Comments
Post a Comment