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;
}
Developer technologies | Windows Presentation Foundation
Developer technologies | Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
Developer technologies | .NET | .NET CLI
Developer technologies | .NET | .NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
Developer technologies | C#
Developer technologies | C#
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.
Sign in to answer