.NET/C#/WPF Create WPF Window from Non-WPF Application

Creating a WPF window from a non-WPF, standard Windows application:

class Program
    {
        static void Main(string[] args)
        {
            Thread thread = new Thread(new ThreadStart(() =>
            {
                // Create WPF window
                MainWindow window = new MainWindow();
                window.Show();
 
 
                System.Windows.Threading.Dispatcher.Run();
            }))
            {                
                IsBackground = true
            };
            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
        }
    }

It seems that DynamicResource has to be used instead of StaticResource in XAML files (at least if the referred resources are defined in a resource dictionary which is included in App.xaml).