MVVM Light - master / child views and dependency properties
- by Carl Dickinson
I'm getting an odd problem when implementing a master / child view and custom dependency properties.
Within my master view I'm binding the view model declaratively in the XAML as follows:
DataContext="{Binding MainViewModelProperty, Source={StaticResource Locator}}"
and my MainViewModel is exposing an observable collection which I'm binding to an ItemsControl as follows:
<ItemsControl ItemsSource="{Binding Lists}" Height="490" Canvas.Top="10" Width="70">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Canvas>
<local:TaskListControl Canvas.Left="{Binding ListLeft}"
Canvas.Top="{Binding ListTop}"
Width="{Binding ListWidth}"
Height="{Binding ListHeight}"
ListDetails="{Binding}"/>
</Canvas>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
TaskListControl in turn declares and bind to it's ViewModel and I've also defined a dependency property for the ListDetails property.
The ListDetails property is not being set and if I remove the declarative reference to it's viewmodel the dependency property's callback does get fired.
Is there a conflict with declaratively binding to viewmodels and definig dependency properties?
I really like MVVM Light's blendability and want to perserve with this problem so any help would be apprectiated.
If you'd like to receive the source for my project then please ask