I have run into a very strange behavior with WPF .NET 4 and PRISM v4. When one of our modules adds its view to an ItemsControl region in the shell, the Foreground value of TextBlocks within that view are all set to the default inherited value of the
window (Black). All of the other values set in the TextBlock style are applied correctly, and if I change the region to be a ContentControl (for example) then the issue goes away - and the TextBlocks receive the correct Foreground color from the style.
I'm setting the style on the TextBlock using a DynamicResource markup and the style is defined in a resource dictionary in a separate assembly, which gets loaded at runtime (so no reference to the skin assembly from the other projects).
I did some debugging and found that the style's value is set initially on the TextBlock, however after that the foreground is set a second time to the inherited default value (the ValueSource in the dependency property changed handler indicated "Inherited"
and the value was Black).
I was able to strip down our application and reproduce the issue. Here is a link to download the .zip file from MediaFire: http://www.mediafire.com/?cn918gi15uph1xe
I am not sure if this has anything to do with the ItemsControlRegionAdapter and the fact that the ItemsSource is pointing to a list containing the view UserControl? I am completely stumped, to be honest, and I need to resolve this issue ASAP.
If you are able to try out the sample project, look at line 20 in ShellView.xaml of the Shell project. Run the app and verify that at the top of the screen is black text (it's difficult to read, sorry - forgot to change the background to a lighter
color), and in the center is white text. Then go back to the ShellView and change the region on line 20 to a ContentControl. Run the app again, and you will see that both the text at the top and bottom are white - as the style specifies.