views:

26

answers:

1

Hi,

I'm still fairly new to silverlight, so hopefully this is an elementary question: I have a polyline whose 'Points' (type: PointsCollection) property is bound to a PointsCollection public member, Pts, in my view model class. When I add/remove points from ViewModel.Pts, the polyline redraws correctly without any problem. However, if I change Pts to be a reference to another, totally different PointsCollection object in my view model class, then the polyline doesn't automatically redraw. The Polyline.Points binding still refers to ViewModel.Pts, but now ViewModel.Pts refers to ViewModel.OtherPts. When I reassign ViewModel.Pts to ViewModel.OtherPts, I want the polyline to automatically redraw with the data in ViewModel.OtherPts.

Is there some event or some nuance in the dependency property system that I'm missing?

Thanks!!!

btw- I'm not using any ObservableProperty or ObservableCollections here since I thought this would all work within the dependency property + databinding system.

+1  A: 

Is your PointCollection a DependencyProperty inside an object that derived from DependencyObject, or, alternatively, is it inside an object that implements the INotifyPropertyChanged interface, and do you raise the PropertyChanged event in the Points property setter?

Those are the two options you have to notify the UI layer of the change (that you now reference a different collection) from the view model. The UI won't know about the change unless you tell it so.

Omer Raviv