Hi,
I have the following scenario (I'm using Silverlight4 Beta):
UserControl A: -> DataContext is an object of class MyModel which contains properties Property01 (CustomClass), Property02 (CustomEnum). The MyModel class implements INotifyPropertyChanged and all properties are calling the PropertyChanged event whenever they cange.
UserControl B: -> DataContext must be an object of type (CustomClass) -> DependencyProperty MyProperty of type (CustomEnum)
My UserControlA will contain a UserControlB and I would like to bind the properties in the following way (from XAML):
-> UserControlB.DataContext = UserControlA.DataContext.Property01
-> UserControlB.MyProperty = UserControlA.DataContext.Property02
<!-- DataContext = MyModel -->
<Grid x:Name="LayoutRoot">
<foo:UserControlB x:Name="xpto" DataContext="{Binding Property01}" MyProperty="{Binding Property02}" />
</Grid>
Making things up like above sets the DataContext of UserControlB to the correct value, however the binding on UserControlB.MyProperty never occurs. If I remove the statement DataContext="{Binding Property01}" then the binding on UserControlB.MyProperty WILL occur.
Can someone please explain me if I'm doing something that goes agains the universal laws of Silverlight :-)
Many thanks in advance, Bruno