c# - ObservableCollection Refresh is not working, when dynamic allocated -
public observablecollection<model.childcommand> childcommands { get; private set; }
childcommands bound datagrid.
both segments show me items in datagrid.
but in segment 1 datagrid items doesn't refresh automatically when collection changes. segment two, refresh works.
segment 1:
var childs = child in m_context.childcommand.local select child; this.childcommands = new observablecollection<model.childcommand>(childs);
segment 2:
this.childcommands = m_context.childcommand.local;
how automatic refresh using segment one?
the reason segment 1 not updating automatically end binding different observablecollection instance.
when m_context.childcommand.local changes, segment 2 datagrid gets notified because bound observable collection instance. segment 1 datagrid bound different observable collection instance (that create when new observablecollection(childs).
if want both of them bound m_context.childcommand.local observable collection should implement such instead of creating different observable collection instance segment 1.
Comments
Post a Comment