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

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -