Call UserControl from a C# DLL, works not.

Markus Freitag 3,786 Reputation points


how can I call a WPF UserControl from a C#DLL and check the OK event?

With C# WinForms this is possible. Why not with WPF?

 public static void Setup()  
     Uri iconUri = new Uri(@"test.ico", UriKind.RelativeOrAbsolute);  
     Window window = new Window  
     Title = "My User Control Dialog",  
     Content = new UserControlSetup(),  
     ResizeMode = ResizeMode.NoResize,  
     ShowInTaskbar = true,  
     Icon = BitmapFrame.Create(iconUri)  
     bool? ret = window.ShowDialog();  
     int z = 0;  
    public static int CallSetupDialog()  
     //Thread ThreadSetup;  
     //ThreadSetup = new Thread(() => Setup());  
     SetupDlg = new frmSetup();   // WinForms looks ok.  
     return 0;  

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,694 questions
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
324 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,484 questions
{count} votes