wpf - Nullable database property but texbox still shows red border when content deleted -


hi binding wpf textbox entity framework property follows:

<textbox grid.column="1" grid.row="0" margin="5,2"           text="{binding path=myentityobject.sizelower, mode=twoway}" /> 

it binds fine property , when change it, saves db expected. if delete content of textbox red error border around it. dont have validator in place guessing texbox complaining value not being nullable. in fact property in db nullable, cannot understand why error.

the system generated ef property definition follows:

<edmscalarpropertyattribute(entitykeyproperty:=false, isnullable:=true)> <datamemberattribute()> public property sizelower() nullable(of global.system.int64)             return _sizelower     end     set         onsizelowerchanging(value)         reportpropertychanging("sizelower")         _sizelower = structuralobject.setvalidvalue(value)         reportpropertychanged("sizelower")         onsizelowerchanged()     end set end property  private _sizelower nullable(of global.system.int64) 

is there missing? thought binding system able determine if property nullable , allow nulls if so?

how can see error is? hovering doesnt seem trick.

thanks advice.

=================================== additional info

if select , delete, change focus, validation box appears. here's screencapture before , after. have confirmed can manually put nulls in database bound properties thats not problem.

denied. tried put picture here dont have 10 points...! here offsite link instead: click here

you should add targetnullvalue property binding:

<textbox grid.column="1" grid.row="0" margin="5,2"           text="{binding path=myentityobject.sizelower,           mode=twoway,           targetnullvalue=''}" /> 

this tells binding treat null values in myentityobject.sizelower string.empty display, , string.empty null when setting.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -