c# - WPF nested ListBox control does not update the list it is bound to -


i have following 2 classes (with altered names), used populate listview nested listbox

private class objectname //for listview {     public int id { get; set; }     public string field1 { get; set; }     public string field2 { get; set; }     public list<babyobject> field3 { get; set; } }  private class babyobject //for nested listbox {     public string field1 { get; set; }     public bool field2 { get; set; } } 

i populate observable collection objects , set itemssource of listview.

my listview correctly displays objects in each listviewitem, , nested listbox in each item correctly displays each babyobject.

the problem: if edit id, field1 or field2 values using ui, observable collection in memory updates - of course does, because of binding. if edit of babyobject's values, list in memory doesn't change.

therefore, when change controltemplate of listview (so values displayed in labels instead of textboxes), babyobject values change original.

i know people have trouble updating interface when lists updated in code, not way round?

i'll happy answer questions , include more code xaml rather large. in meantime going make separate example listview see if can test on smaller control.

thanks

you need raise property change notification when properties set - tells bindings update.

msdn docs here


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -