SQL Police
SQL Police

Reputation: 4206

Office Addin with WPF?

I'm creating an Office Addin which provides various custom dialog windows.

Now I would like to program these with WPF, however, when I want to add a new item, Visual Studio offers me only WinForms. WPF is offered only for adding a custom control, but not for creating a windows form.

==> So, is it possible to use WPF instead of WinForms in Office Addins?

Upvotes: 1

Views: 1158

Answers (2)

Chris
Chris

Reputation: 3529

This question is old, but here's an answer anyway. It doesn't show up for VSTO projects because they are set up as a class library. You can add one manually. Add a User Control and just change the base class from UserControl to Window in the code, and the root object to Window in the XAML. Then open it normally.

The other answer here about an ElementHost applies to the Task/Actions Pane.

Upvotes: 3

Ron
Ron

Reputation: 81

you can use a System.Windows.Forms.Integration.ElementHost to host the WPF element.

https://msdn.microsoft.com/en-us/library/ms754008%28v=vs.90%29.aspx?f=255&MSPPError=-2147217396

Upvotes: 1

Related Questions