[Solved] Combox Exception

Jul 11, 2010 at 1: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?

Regards
Ruan

Jul 22, 2010 at 3:38 AM
Edited Jul 22, 2010 at 5:11 AM

Hi,

 

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

Quoting:

"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?
Coordinator
Aug 2, 2010 at 11: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 2:03 AM

Thank you that fixed the issue! :)

Aug 5, 2010 at 11:56 AM
Awesome! Thanks
Coordinator
Aug 6, 2010 at 8:38 AM
Thank you for reporting the issue.
Coordinator
Nov 8, 2010 at 12:57 AM

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.

http://blogs.microsoft.co.il/blogs/arik/archive/2010/11/08/windows-ribbon-for-winforms-v2-6-released.aspx