It's possible to do this by code, you have to use "Switch" for both AppContext.SetSwitch:
AppContext.SetSwitch("Switch.System.Windows.Media.ShouldNotRenderInNonInteractiveWindowStation", false);
AppContext.SetSwitch("Switch.System.Windows.Media.ShouldRenderEvenWhenNoDisplayDevicesAreAvailable", true);
And this must be done before Initializing the Main Window! Works for .NET Framework and .NET 5++