How do I work with WIndows Forms in WPF?

Topics: Prism v2 - WPF 4
May 26, 2010 at 7:05 PM

How do I work with WIndows Forms in WPF?

In my WPF program I created a Windows Form class.
In this Form, I placed an OK button and I went into the properties of the button and set the DialogResult to OK.
Now, I am calling this Dialog (Window Form) from the MainWindow.xaml.cs:
     dres = form.ShowDialog();
     f (dres != DialogResult.OK) return;[/code]

The compiler is complaining:

[code]Error 3 'System.Nullable<bool>' does not contain a definition for 'OK' and no extension method 'OK'
accepting a first argument of type 'System.Nullable<bool>' could be found (are you missing a using directive
or an assembly reference?)[/code] 

May 28, 2010 at 1:51 PM


Based on my understanding you have a problem with the enum DialogResult since it seems that there is an ambiguous reference to this in your code context. You can try using System.Windows.Forms.DialogResult.OK.

As this is not strictly related to Prism, you may get better support in the WPF or Windows Forms forums.

Please let me know if this helps.

Fernando Antivero