Set a ribbon togglebutton programmatically on load - vsto

I am trying to set a ribbon togglebutton to true at the start of outlook. I did not use the designer but used XML to design the ribbon. Creating an attribute of isChecked in the XML does not seem to be called or used in any way. Any ideas?

For the toggleButton element, the callback name is getPressed, not isChecked.

Related

Assign Event by Event Handler

In my application i am using Krypton Component Factory.
My application i have Ribbon Menu and Some krypton buttons. In krypton buttons i want to assign click event of Ribbon Menu Group Button at run time. The events of Ribbon Menu Group Button Changed Based some condition so i tried like this
Dim eventsField = GetType(Component).GetField("events", BindingFlags.NonPublic Or
BindingFlags.Instance)
Dim eventHandlerList = eventsField.GetValue(KryptonRibbonGroupButton1)
eventsField.SetValue(KryptonButton1, eventHandlerList)
Its not work. The Get Field always return nothing.
Problem: I want add handler of Krypton Button Click event by old ribbon menu button throw coding using the controls name only. Its Possible or not? Its possible how to do it?
am using Vb.Net
Perhaps you're looking for AddHandler?

change the ribbon if new outlook-folder is selected

I want to show/hide Buttons depending on the Name of the actual Folder.
No Problem to do this with
Me.btn1.Visible = True 'or false, whatever is necessary
But: how can I check for a change of the current Folder?
Thanks
Max
Your ribbon XML must specify the getVisible callback name.
Call IRibbonUI.Invalidate, Outlook will then invoke your getVisible/getEnabled callbacks.
IRibbonUI can be cached when Outlook invokes your onLoad callback (specified on the customUI XML element).

How to disable only the expander togglebutton WPF

I'm trying to disable the expander togglebutton dynamically using IsEnabled property and when I do that, the whole content is disabled also.
I want to disable the togglebutton while keeping the content controls enable.
Thank's
Elad
Make a copy of the style template for the Expander, find the toggle button within the template and set your IsEnabled property to it specifically instead of to the Expander control itself.
So, in Expression Blend right-click an Expander control and go to Edit Template -> Edit a Copy and save a copy of your template wherever you like, in most cases a resource dictionary is the best idea. Find the button object in the template that is your expander button and put your IsEnabled property there. Then just apply that style template to your expander control like <Expander Style="{StaticResource YourNewExpanderTemplateName}.../> so that the IsEnabled dependency property applies just to the button object instead of the entire control.
Give it a shot. Cheers!

Refreshing the ribbon interface after a call from a macro in an excel sheet

Here is my scenario:
I have an old excel project with macros that I've imported in a vsto project.
I have designed a custom ribbon (startFromScratch = true) to make it look like a dictator application.
I still want to use the existing macro code since it would take too much time to translate all the vba code in c# code
I have a class that is marked with the [ComVisible(true)] attribute so that I can call vsto methods from the vba code.
The problem is that I can't hide tabs, I can't get the ribbon to refresh. I can change the state of other controls (e.g. set checked state for CheckBox), but I can't hide or disable my custom tabs.
I have tried PerformLayout(), PerformDynamicLayout() on the ribbon, ribbon.RibbonUI.Invalidate(), but nothing works, the tab never changes state, although in code I set its visible property to false.
What do I need to do in order to refresh the ribbon at runtime?
Edit:
I just tried the same thing by exporting the ribbon to xml and the Invalidate() method works as expected. Is there any way to accomplish this for a ribbon designed with the visual editor?
I've replicated your problem when I set the StartFromScratch property of the ribbon to True, but it goes away when I set it to False. This is confirmed by MSDN.
You cannot change the visibility of custom tabs at run time if this property is set to true.
As a workaround, set StartFromScratch to False, add in a tab for each default tab, setting the ControlIdType of each to Office and the OfficeId of each to their default name (TabHome, TabFormulas, etc.), then set each of these built-in tab's visibility to False. (MSDN has made available a full list of control IDs for their Office apps for easy reference.)

Using Label property of Office Ribbon Control in vba

Is there a way to read/get the Label attribute of an Office 2007/2010 ribbon control in VBA? The only exposed properties appear to be Tag, ID, and Context.
I'm trying to use the getLabel and getVisible callbacks together--read the label and determine whether or not to show a control. I tried setting the Tag property in the getLabel callback, but the code won't compile as that property is read-only by then.
Any other suggestions for how to skin this cat welcome. Note that I cannot use a dynamic menu; this is under a split button, and has to stay there. Thanks in advance.
I suspect that VBA doesn't have access to customize the Ribbon UI. I do know for a fact that this can be handled with VSTO.