Dynamically Updating Objects in a Silverlight Application?
Maybe I just thought about this and need to write some more prototypes, but I would like to get some of your thoughts:
Basically the app will render up to several hundred custom visuals in an X / Y grid. The position and attributes of some of these objects may change between updates; the application will receive updates periodically via web service calls made approximately every minute.
My question is, what's the best way to handle these updates on the client? I've considered either searching for each object, updating it directly, or creating a "tree" of data objects that will update in the background thread - once all updates have been applied in the background, the displayed objects will be recreated based on the data in the "tree".
Anyone can suggest any suggestions anyway? Are there any Silverlight design patterns that might work well?
a source to share
I would use a data layer and bind to properties in the XAML-ala mvc model - and base your objects on INotifyPropertyChanged, then the UI will automatically update them when the data is updated. Just compare the new value with the existing value
int SomeNumber
{
get { return this.m_someInt; }
set { if ( value != this.m_someInt )
{
this.m_someInt = value;
NotifyChange("SomeNumber");
}
}
NotifyChange( string propName )
{
.....
}
a source to share