I have a C# VSTO Excel add-in that uses XML for the ribbon. In it, there are multiple ToggleButtons that all use the same functions used in their 'getLabel', 'getKeytip', 'getScreentip', 'getSupertip', 'getPressed', & 'onAction' callbacks. Those functions then return the correct value or execute the correct code based on the control's ID.
Is it possible to create a 'template' for these elements that sets these attributes, but allows me to provide the ID?
For example here is what I currently have:
<toggleButton
id="tb1"
getLabel="GetLabel"
getKeytip="GetKeytip"
getScreentip="GetScreentip"
getSupertip="GetSupertip"
getPressed="Togglebutton_GetPressed"
onAction="Togglebutton_OnAction"/>
<toggleButton
id="tb2"
getLabel="GetLabel"
getKeytip="GetKeytip"
getScreentip="GetScreentip"
getSupertip="GetSupertip"
getPressed="Togglebutton_GetPressed"
onAction="Togglebutton_OnAction"/>
<toggleButton
id="tb3"
getLabel="GetLabel"
getKeytip="GetKeytip"
getScreentip="GetScreentip"
getSupertip="GetSupertip"
getPressed="Togglebutton_GetPressed"
onAction="Togglebutton_OnAction"/>
<toggleButton
id="tb4"
getLabel="GetLabel"
getKeytip="GetKeytip"
getScreentip="GetScreentip"
getSupertip="GetSupertip"
getPressed="Togglebutton_GetPressed"
onAction="Togglebutton_OnAction"/>
<toggleButton
id="tb5"
getLabel="GetLabel"
getKeytip="GetKeytip"
getScreentip="GetScreentip"
getSupertip="GetSupertip"
getPressed="Togglebutton_GetPressed"
onAction="Togglebutton_OnAction"/>
And I'd like to be able to specify a 'template':
<toggleButtonTemplate
getLabel="GetLabel"
getKeytip="GetKeytip"
getScreentip="GetScreentip"
getSupertip="GetSupertip"
getPressed="Togglebutton_GetPressed"
onAction="Togglebutton_OnAction"/>
And then have my ribbon XML be updated to something like:
<toggleButtonTemplate
id="tb1"/>
<toggleButtonTemplate
id="tb2"/>
<toggleButtonTemplate
id="tb3"/>
<toggleButtonTemplate
id="tb4"/>
<toggleButtonTemplate
id="tb5"/>
Is something like this possible? If so, how would I go about doing it?