Binding UserControl to a NULL DataContext
- by user634981
I have a UserControl and am binding its DataContext to an object. I also bind the IsEnabled property of the UserControl to a boolean property of that object eg:
<my:MyUserControl DataContext="{Binding Items.SelectedItem}" IsEnabled="{Binding Path=IsEditable}"/>
This works fine provided Items.SelectedItem is not null. However, if it is null…