I created a custom control in C# which has its template defined in Themes/Generic.xaml. The control (along with Themes/Generic.xaml) is defined in a project which outputs to a DLL. I'm not sure if this is important, but the control is in a subfolder.
When I reference the control from the main executable, OnApplyTemplate()
in the control's C# is never called, and the control shows up with no style information applied.
This only happens in the release build; the debug build works fine.
If I redefine the template in the resources of the control hosting the control (e.g. Window.Resources) the control works fine. It seems that Visual Studio is not linking Themes/Generic.xaml to the control.