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,271 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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;
}
A WPF UserControl is just a C# class. Given your recent posts, my best guess is you are having trouble with fundamental C# constructs.
Please share your WPF code so the community can reproduce your results. Clearly explain your expected results and the actual results. This information will help us help you.
If the actual problem is creating a dialog then see the following Google search.
Hello,
I am not sure. My concept is as follows.
I can call up a WinForms dialogue. I don't know if it's the C++, CLI problem.
Hello,
Thanks. I have only this code. search
My goal is here a return value
This works not.
0 --> OK Button
1 -- Cancel Button
search
Notwithstanding the overall theoretical concept there is absolutely nothing in your posted question regarding C++.
Sign in to comment