c# - WPF TwoWay not working on X (exit) but works on TAB or clicking elsewhere -


i have following in xaml:

<textbox name="titlevalue"           text="{binding elementname=listvalue, path=selecteditem.title, mode=twoway}"  <textbox name="descvalue"          text="{binding elementname=listvalue,                          path=selecteditem.description, mode=twoway}" 

when enter value in either titlevalue or descvalue , tab or click on different location in window, collection class properties updated correctly. when click x exit window, data in collection class saved correctly.

however, when enter value in either of fields, click x exit window, data in collection class saved, value entered not saved particular field editing when clicked x.

i implemented lose focus event on fields , work, when x clicked. in events put code:

private void event_descvalue_losefocus(object sender, routedeventargs e) {     ((import)listvalue.selecteditem).description = ((textbox)e.originalsource).text; } 

but didn't work either. following not work either:

imports[listvalue.selectedindex].description = ((textbox)e.originalsource).text; 

how collection class imports update selected class import when x clicked when in field being edited?

it should work had tabbed off field being edited or clicking elsewhere in window.

modify binding's updatesourcetrigger propertychanged.

like so:

<textbox name="titlevalue" text="{binding elementname=listvalue,       path=selecteditem.title, mode=twoway, updatesourcetrigger=propertychanged}"/> 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -