Message 1 of 3
How can I remove an event after updating the items of RibbonSplitButton ( remove childs and add new childs )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello , I'm trying to remove the event listeners of Childs of RibbonSplitButton , the update works good but I need to remove the event listener .
I've tried this code , but it doesn't work. However, when I'm try clicking on any of button , it will execute multiple times ( multiple calling of the execute event ) .
public void RemoveEvent(int btn_ID)
{
BtnID = btnID;
BtnDef.OnExecute -= BtnDef_OnExecute;
}
// Calling removeEvent
// SplitBtn is my RibbonSplitButton
foreach (CommandControl child in SplitBtn.ChildControls)
{
child.Delete();
if (Btns_indexCopy.Count() > 0)
{
_BtnDefEvents.RemoveEvent(Btns_indexCopy[counter]);
}
}