Call UserControl from a C# DLL, works not.
Markus Freitag
3,791
Reputation points
Hello,
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());
//ThreadSetup.SetApartmentState(ApartmentState.STA);
//ThreadSetup.Start();
SetupDlg = new frmSetup(); // WinForms looks ok.
SetupDlg.ShowDialog();
return 0;
}
Sign in to answer