My WPF application uses custom controls in a referenced library. To simplify deployment, all dependent DLLs are embedded resources of the application EXE file.
Read Jeffrey Richter: Excerpt #2 from CLR via C#, Third Edition to get the details.
The problem with this setup is that the generic.xaml from the referenced library is not applied. Resulting in an empty from on application start.
By writing some information to the tracelog I noted the ApplyTemplate was not fired. There are loads of discussions about this when you google, but all discuss the assembly: ThemeInfo settings. Which is not my problem. Everything works fine when the referenced library is located in the same folder …
Eventually I loaded the generic.xaml only in the controls and removed the MergedDictionaries from my MainWindow. This did the trick. Try my Sample solution. On the first run you get the almost empty window after the 3 second wait. Then locate the adding of generic.xaml in the constructor of MainWindow.xaml.cs and comment/remove it. Now everything works even when MyControl is removed.