[Solved] Combox Exception

Jul 11, 2010 at 12:25 PM

Hi Arik,

I have encountered a new problem when I tried to build the Combox example. The example works if the comboxes are places on the first/main tab which is viewed when the form is launched.

If there are multiple tabs and the comboxes are placed on tabs other than the first one, the FillComboBoxes() routine throws a NullReferenceException. i.e. _comboBox1.ItemsSource is null. I believe tab objects are not initialized until they are viewed. Since the Ribbon Framework doesn't support Tab Click event, I don't know where to put the FillComboBoxes() to initiate the combox items when it's viewed.

Can you help please?


Jul 22, 2010 at 2:38 AM
Edited Jul 22, 2010 at 4:11 AM



I'm also seeing the same issue with the ComboBox when it is inside another tab.


EDIT: So I guess the problem stems from http://msdn.microsoft.com/en-us/library/dd940492%28v=VS.85%29.aspx


"Typically, a Combo Box property is updated in the ribbon UI by invalidating the Command associated with the control through a call to the IUIFramework::InvalidateUICommand method. The invalidation event is handled, and the property updates defined, by the IUICommandHandler::UpdateProperty callback method.

The IUICommandHandler::UpdateProperty callback method is not executed, and the application queried for an updated property value, until the property is required by the framework. For example, when a tab is activated and a control revealed in the ribbon UI, or when a tooltip is displayed.

Note  In some cases, a property can be retrieved through the IUIFramework::GetUICommandProperty method and set with the IUIFramework::SetUICommandProperty method."
Which is accurate, i see the appropriate lists allocated once I change tabs.  I've tried calling IUFramework::GetUICommandProperty but that returned with an E_FAIL.  Is there some other way this should be handle to initialize the comobox correctly when not in the first tab?
Aug 2, 2010 at 10:12 PM
I've made some changes with how the ribbon wrapper handles items in gallery / combobox. Hopfully, this will solve all of your problems. Here are some details: http://blogs.microsoft.co.il/blogs/arik/archive/2010/08/03/windows-ribbon-for-winforms-v2-3-released-bug-fixes.aspx You can get the latest release (v2.3) to check.
Aug 3, 2010 at 1:03 AM

Thank you that fixed the issue! :)

Aug 5, 2010 at 10:56 AM
Awesome! Thanks
Aug 6, 2010 at 7:38 AM
Thank you for reporting the issue.
Nov 7, 2010 at 11:57 PM

I've made a new fix for this bug, since the old fix caused some problems with galleries.

You can check the combobox sample (6) on the latest release (v2.6) for more details.