Master / child views and dependency properties

Apr 18, 2010 at 5:19 PM
Edited Apr 19, 2010 at 6:56 AM

HI

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