Visio Guy

Visio Discussions => Programming & Code => Topic started by: marie99 on June 14, 2018, 05:15:38 AM

Title: Visio 2016 new drawing from Addin missing ribbon
Post by: marie99 on June 14, 2018, 05:15:38 AM
This is a weird one and I am stumped.  I have developed a few custom apps in C# that allow the user to click a backstage button, and the handler creates a new blank drawing.  A few weeks ago, a client using Visio 2016 noticed that the drawing opened with blank white space where the ribbon should be.  Hitting Alt-F to return to the backstage, then the arrow to return to the drawing makes the ribbon appear.  His users using Visio 2013 aren't seeing this.

I wrote a small addin that only has the one backstage button that opens a blank drawing:
VisioApplication.Documents.Add(string.Empty);
And this shows this problem.  I've used both VS 2010 and VS 2017, and see the problem in both.  I've also tried AddEx with no change.

Any idea on how to get Visio to fix this, or how I can work around it in code?  Is there code to go to the backstage, then return to the drawing so that I can simulate what the users now have to do?

Thanks for any help!
Title: Re: Visio 2016 new drawing from Addin missing ribbon
Post by: Nikolay on June 14, 2018, 07:43:57 AM
1. Can you share the code?
2. Have you tried to refresh the ribbon (ribbonUI.Invalidate)
3. Have you tried to move you action to Idle/NoEvenst pending?
Title: Re: Visio 2016 new drawing from Addin missing ribbon
Post by: marie99 on June 14, 2018, 06:07:17 PM
I'd already tried ribbon.Invalidate with no effect, but moving the Documents.Add call on to the Idle handler did the trick.  Thanks for the tip!