Monday, 15 June 2015

wpf - SelectedItem is null in DataGridTemplateColumn with ComboBox -



wpf - SelectedItem is null in DataGridTemplateColumn with ComboBox -

i have datagrid , datagridtemplatecolumn combobox

<datatemplate x:key="comboboxpackagingtype"> <combobox selecteditem="{binding packagingtype.selecteditem, mode=twoway}" itemssource="{binding packagingtype.itemssource}"/> </datatemplate>

...

<datagridtemplatecolumn celltemplate="{staticresource comboboxpackagingtype}"/>

the selecteditem never changing value after selecting item list. set breakpoints on both , set functions , stopping on function after changing itemsource of datagrid never on set function after selecting item list.

why?

try adding updatesourcetrigger=propertychanged binding of combobox's selected item so:

<datatemplate x:key="comboboxpackagingtype"> <combobox selecteditem="{binding packagingtype.selecteditem, mode=twoway, updatesourcetrigger=propertychanged}" itemssource="{binding packagingtype.itemssource}"/> </datatemplate>

this worked me.

wpf datagrid datagridtemplatecolumn

No comments:

Post a Comment