Reputation: 656
I have a Silverlight 4 application which uses the MVVM pattern. I have: 1. A standard View 2. A standard ViewModel 3. A separate UserControl which essentially is a wrapper around a DataGrid.
I have placed the UserControl on to my View whose DataContext is the ViewModel. The ViewModel has a property which contains information required by the UserControl (configuration details for the grid). I wish to create "something" within the UserControl so I can bind to the property on the ViewModel and when this property changes the UserControl can reconfigure itself as required.
Is this something a "DependencyProperty"?
RESOLUTION:
I took sternr's advice and implemented a DependencyProperty within the UserControl in order to bind to a property on the ViewModel. I used a Visual Studio snippet from the following link to help code the property: http://wildermuth.com/2009/03/09/Silverlight_Dependency_Property_Snippet
Upvotes: 0
Views: 139
Reputation: 6506
In order to use the PropertyName="{Binding}"
mechanism, you have to use a DependencyProperty.
However, if you only what to enable other resources to subscribe to changes over one of your properties, it is sufficient to implement the INotifyPropertyChanged interface
Upvotes: 2