how to update ribbon menu items before menu is shown

Aug 26, 2009 at 10:39 PM

I have a RibbonDropDownButton.  Two things I'd like to do with it

1) wait until the user clicks the button before building or rebuilding the menu items that it contains. Like because depending on context, the items could change.

2) whenever the button is clicked (or more accurately, before the menu is made visible) update the state of items that exist in the menu. Specifically, I'd like to set the IsChecked state on various RibbonCheckBox items contained in the RibbonDropDownMenu.Items collection.

So far, I can't get it.

I've tried adding event handlers to the dropdown button's GotFocus, MouseDown, and Command.Executed events, no joy.

So, what is the correct approach to doing this sort of thing?

Thanks

Aug 26, 2009 at 11:29 PM

Ok, Never mind on #2, that can be accomplished easily enough with data binding.

And, for that matter, I suppose so could #1. But, I don't want to do it that way.  I want to (re)create the items for a (bunch of) drop down menu buttons only when needed, sometime between when the button is clicked and when the menu shows.

Thanks