Force update toolbar command status RRS feed

  • Question

  • I've got a toolbar on one of my tool windows. Now I would like to force update the status of all toolbar commands, e.g. because some of them need to be enabled/disabled after/before loading data. Is there a way to do it besides calling IVsUIShell.UpdateCommandUI? ForceUpdateUI on the toolbar host does not seem to do anything -> command status is requeried only when I perform a mouse-click, but not when navigating with the keyboard. 


    EDIT: my environment is VS 2008 SP1/Windows 7/C#.
    Sunday, January 31, 2010 10:10 AM

All replies

  • Hi Liggett78,

    I don't understand why you don't want to use IVsUIShell.UpdateCommandUI to update toolbar command status. As far as I know, it's great and direct way to update command status. There is a article about Updating the User Interface using UpdateCommandUI

    How to: Update the User Interface

    Or you can use Commands2.UpadateCommandUI method to force a refresh of the command UI state.

    If I misunderstood you, or you have any questions, please let me know.

    Best Regards,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, February 2, 2010 7:28 AM
  • Well, since my toolbar is only "local" to the toolwindow, I don't want to incur the overhead of requerying 100s of global commands etc. I am using IVsUIShell.UpdateCommandUI now and it's working fine, however I do have one or two commands that need to be updated when data selection changes, e.g. the delete command. I can imagine that calling UpdateCommandUI every time the user selects another row would be not quite optimal, though I have not tested it yet. Thanks.
    Wednesday, February 3, 2010 10:17 AM