Ribbon 1.3 Gallery.Items not working as expected

Nov 6, 2010 at 7:25 PM

I have successfully implemented a DropDownButton with a Gallery dynamically populated with data. I have also successfully been able to fire an event that lets me do something useful with the user selection (magic words, when the selection changes). The last piece of what I need to do is to use code to select a specific item in the Gallery. When I look at the expected Items collection, it is unpopulated and the Items.Count is therefore 0.

To be clear, here's my scenario:

  1. Launch the app which fills the Gallery from my database.
  2. Do something to add a new record to that table in the database.
  3. Reload the Gallery so it contains the new record. The scenario works up to this point.
  4. Search the contents of the Gallery, find the record that was just added, and select it. When selected, there are some other things I do but that's less critical to this issue.

The last step never works as the only thing I can find to use is the Items collection which has no contents. In the locals window I can see a listBox object which is a Fluent.RibbonListBox that looks like it has what I need but haven't found a way to get at it yet.

Advice is much appreciated. Thanks in advance.

Nov 6, 2010 at 11:26 PM

Found a workaround. I'm iterating the data source itself to determine the index of the item I want rather than trying to iterate the Gallery Items collection, then setting the Gallery.SelectedIndex to the one I find. This will work as long as the order of items in the Gallery and my list is the same, which in my case it will be.

It would still be nice if the Items collection of the Gallery would actually work.