Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ribbon instances per Document

I am using VSTO 3.0 and the ribbon designer gives me a ribbon that is apparently shared across documents.

So if I have Document specific state( number of XML marked up tags say) that needs to show up in the ribbon( or a toggle button ) then all documents seem to share the ribbon instance

How can I fix this TIA

like image 381
Rahul Avatar asked Mar 01 '23 04:03

Rahul


1 Answers

You can use Application.DocumentChange event or Application.WindowActivate event.

The first is fired then you change the current active document, but in the arguments there's no information about that document, so it's difficult to work with because you'll have to figure that out.

The latter is similar and it's fired every time you change of window but in this case it passes the current active document as an argument, so it's easier to change the ribbon if you need to check the value of any document property. That worked for me.

like image 181
Marc Climent Avatar answered Apr 01 '23 06:04

Marc Climent