I am fairly new to the Microsoft CAB framework and am running into an issue where I cannot "unhide" the ribbon bar in my application since it is set while the application is loading. I can unhide/show it afterwards in an event in a WorkItem controller as follows:
' Show Ribbon
<EventSubscription(Constants.Events.HideRibbon, ThreadOption.UserInterface)> _
Public Sub hideRibbon(ByVal sender As Object, ByVal e As EventArgs)
mShellUIExtensionService.ShowRibbon(True)
End Sub
I thought I could possibly publish the above event from a view that is loaded on startup, but alas the Ribbon bar is still hidden after the application launches.
Someone at my company is using the following hack that sends the F1 key to the application from the "ShellCreated" event (that I believe is a reserved word event since I can find the event publication anywhere in the code), but I find that it can sometimes send the F1 key to the wrong application like Word, Outlook, etc:
'This works, kind of...
'===Maximize the RibbonBar automatically on Startup===
<EventSubscription("ShellCreated", ThreadOption.UserInterface)> _
Public Sub OnShellCreated(ByVal sender As Object, ByVal e As EventArgs)
System.Windows.Forms.SendKeys.Send("^{F1}")
End Sub
I tried adding mShellUIExtensionService.ShowRibbon(True) to the above OnShellCreated function but the ribbon bar remains hidden still.
I suspect the problem lies in the order that the CAB architecture is loaded, so does anyone know how to set a property loaded by CAB after the application is loaded? Or at least know how I can work around this issue?
Through trial and error, I found the following to work:
<EventSubscription("ShellCreated", ThreadOption.UserInterface)> _
Public Sub OnShellCreated(ByVal sender As Object, ByVal e As EventArgs)
mShellUIExtensionService.RibbonBar.IsMinimized() = False
End Sub