Missing "Resource Dictionary" in menu "Add item" in VSTO solution

Viewed 48

In Ms Word I'm trying to add TaskPane with WPF controls. I know that I have to add host winforms control to taskpane and later add wpf contorls to this host. Its works for me and everythig works.

But when I want to properly add pretty wpf control using resource dictrionary I cant, bacause there isnt't resource dictrionary on list to add from "Add->New Item..." menu.

There is no problem with other wpf projects, but in VSTO I can't.

Checked on Visual Studio 2019 and 2022. Using search on this window don't find proper resource template.

What am I doing wrong? Or maybe it's not VSTO's fault but something completely different?

Screen with non VSTO solution and VSTO Solution

1 Answers

It's not the most elegant way to get around this but at least it's a way around:

  1. Add a user control to your folder

  2. Open the XAML and remove all the user control references and make it look like below

    < ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> < /ResourceDictionary>

  3. go to solution explorer and expand the subfiles in the XAML that you want as a resource and delete the .cs

how to delete the folder

Hope this helps

Related