Could make it work.... folow the code
public void RibbonAction(IRibbonControl control)
{
void ShowWindow()
{
.... create window and content....
w.Show();
}
if (Application.Current is null)
{
Thread thread = new(x => {
using var scope = AssemblyLoadContext.EnterContextualReflection(typeof(...sometype....).Assembly);
var application = new Application();
.... configure application resources.........
ShowWindow();
Application.Current.Run();
});
thread.SetApartmentState(ApartmentState.STA);
thread.IsBackground = true;
thread.Start();
}
else
{
Application.Current.Dispatcher.Invoke(ShowWindow);