Post command doesn't execute command after panel was hidden

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm having trouble with getting a command to execute using an external event. I'll explain.
I have an app that creates a ribbon tab, a panel and a button which executes a command. Now I also have a button that I add to an existing tab. That button should execute the same command as the button in my own panel, so I use UIApplication.PostCommand.
This seems to work well, except when my own ribbon panel was hidden. I want to hide that panel when there is no active project, and show it when there is. For some reason, the command just doesn't get executed in this case. When I lookup the command using RevitCommandId.LookupCommandId, I do get a valid RevitCommandId.
I've attached a sample (VS2015) project demonstrating the issue. If you run it, everything works. If you uncomment line 32 in TestCommandRibbon.cs, the command won't get executed anymore.
Can someone explain me what's going on, and possible help me with a solution? Thanks in advance.