mvvm - WPF Combobox text binding issue on tab chage -
i working in wpf application follows mvvm.
i have used binding in combobox's text property , combo inside tab.
when ever switch tabs, combobox's text property cahnged getting fired , text set string.empty.
if don't want text ever empty, try:
view
<combobox text={binding comboxtext} ... />
edit comment:
<combobox text={binding comboxtext, targetnullvalue=somevalue} ... />
viewmodel
/*inotifypropertychanged property*/ private string comboxtext; public string comboxtext { { return comboxtext; } set { if (value != comboxtext) {// value changed -> if (!string.isnullorwhitespace(value)) {// value not null, empty, whitespace -> comboxtext = value; } /*inpc code*/ } } }
Comments
Post a Comment