c# - Items in Datagrid not updating on all clients once ObservableCollection has been updated -
i using sl4, mvvm toolkit, entity framework 4 & wcf ria services. have grid datasource observablecollection<ticket>
. ticket oc populated ria service:
private void loadtickets() { isbusy = true; _context.load(_context.getopenticketsforuserquery(session.userid), getticketscallback, null); } private void getticketscallback(loadoperation<ticket> lo) { listoftickets = (observablecollection<ticket>)lo.entities; }
when add new ticket object oc grid shows new item on clients once refreh grid ( every 30 seconds refresh grid each client calling loadtickets()
). works if remove item grid well. however, when update property in ticket object , save ( call submitchanges() on datacontext ) change not show on other clients after refresh grid. have refresh whole page in browser see changes. have read many similar questions on here , must implement inotifypropertychanged on object properties observablecollection.
but, afaik entity framework automatically !? can see properties in model designer.cs , raise propertychanged event when property set. i'm wondering if has fact using ria services ? have tried adding property ticket object ria service metadata , calling raisepropertychanged() event here didn't work either.
[metadatatypeattribute(typeof(ticketmetadata))] public partial class ticket { internal sealed class ticketmetadata : notifiableobject { [required] [stringlength(255, minimumlength=15)] public string ticketsummary { { return ticketsummary; } set { ticketsummary = value; raisepropertychanged("ticketsummary"); } } } }
can shed light on me? it's driving me crazy!! i'm new silverlight development apologies if stupid question :)
ok - got bottom of this. in load() event need set loadbehaviour
_context.load(_context.getopenticketsforuserquery(session.userid), loadbehavior.mergeintocurrent, getticketscallback, null);
this has resolved issue.
Comments
Post a Comment