I can think of two ways to implement dependency properties that are shared between the detail views:
- Store them in the master view model and add data bindings to the detail view models when they are created, and bind to them in the detail view.
- Don't store them in the view models at all, and use FindAncestor to bind directly to properties of the master view instead.
What are the pros and cons of each, and are there other/better options?
Edit:
To clarify, I have a custom control (derived from Control) that uses a master view model for its DataContext. The custom control's control template contains an ItemsControl with ItemsSource bound to a dependency property in the master view model. This dependency property is an ObservableCollection of detail view model objects. The ItemsControl's item template binds to properties in the detail view model. What I need is a single property that is shared by the control template of the custom control (master view) and the item template for all the items in the ItemsControl. The custom control will contain a Slider or something to set the value, and the item template will simply read it.
Sorry if I'm abusing the terms, I'm still trying to get the hang of MVVM. If the problem still is unclear, I can try to write some code for a simple test case.