none
Word 2016 -> Ribbon -> Button -> Display WPF form RRS feed

  • Question

  • I have a WPF form that I'd like to display by clicking a button in Word 2016 Ribbon. I found some Microsoft tutorial, but it tells me to use thing called "UserControl". Sure, I did that. Now how do I launch the form, that is, since it doesn't seem to have any "Display"- or "Show"-method? With Windows Forms it was like:

            private void StartButton_Click(object sender, RibbonControlEventArgs e)
            {
                MyForm mf = new MyForm();
                mf.Show();
            }
    


    Sunday, August 20, 2017 5:06 PM

Answers

  • I have a WPF form that I'd like to display by clicking a button in Word 2016 Ribbon. I found some Microsoft tutorial, but it tells me to use thing called "UserControl". Sure, I did that. Now how do I launch the form, that is, since it doesn't seem to have any "Display"- or "Show"-method? With Windows Forms it was like:

            private void StartButton_Click(object sender, RibbonControlEventArgs e)
            {
                MyForm mf = new MyForm();
                mf.Show();
            }


    Here's what solved it for me:

    https://stackoverflow.com/questions/10164140/open-wpf-form-from-a-vsto-outlook-addin

    i.e. make sure you have "Window" in both XAML and in code-behind file instead of UserControl.

    • Marked as answer by ArtKilp Sunday, August 20, 2017 6:00 PM
    Sunday, August 20, 2017 5:21 PM