First, I have to say that all this already worked flawlessly on .NET 4.0!
Now switching to .NET 4.5 (or even .NET 4.0 with installed .NET 4.5), at ListBox.DataContext I get an XamlParseException.InnerException: System.InvalidOperationException "Binding.StaticSource cannot be set while using Binding.Source"
I implemented a NavigationController as singleton, providing some data to a list. The singleton instance is provided via an ObjectDataProvider representing the Instance property of the singleton.
<UserControl x:Class="UI.WPF.Reuse.Navigation.NavigationView"
xmlns:n="clr-namespace:UI.WPF.Reuse.Navigation"
...>
<UserControl.Resources>
<ObjectDataProvider x:Key="NavigationController" ObjectInstance="{x:Static Member=n:NavigationController.Instance}" />
...
</UserControl.Resources>
<!-- On property DataContext: InvalidOperationException "Binding.StaticSource cannot be set while using Binding.Source" -->
<ListBox DataContext="{Binding Source={StaticResource NavigationController}, Path=(n:NavigationController.CurrentViewModel)}"
ItemsSource="{Binding Path=(n:NavigationViewModel.SubScreens)}"
...
>
...
So, what would be the appropriate construct to bind to a property of a singleton in .NET 4.5? My experiments did not work out so far...