views:

224

answers:

1

How do I display a wpf window in my application when the application resides in a dll, not an exe? This project will be compiled to a dll and loaded into another application as an add-in.

In WinForms, I would just have the following code:

dim frmUserData as frmDataEntry = new frmDataEntry
frmUserData.ShowDialog()

How do I accomplish the same task in WPF?

A: 

With WPF you can just create the new window and show it. It would look very similar to Winforms.

Dim wpfWindow as new WpfWindow()
wpfWindow.Show() 'or ShowDialog depending.

If the UI you're trying to show is a Page, and not a Window, then you'll need to create a NavigationWindow and use Navigate(), passing in the Page you want to use.

Joseph
And for vb.net, just use Dim instead of var and remove the semicolons.
Dennis Palmer
Thanks for pointing that out Dennis, I've changed my answer to VB
Joseph
This was a case of user error. I thought it was the same. It turns out I was looking for frmDataEntry when I should have been looking for MainWindow. . . Thanks for help!
Scott