Hi,
I want to use the GalleryTool at the Ribbon to let the end user choose one item. The items available will be requested via a webservice at program start and will not change until the program is closed. So I am filling the GalleryTool programmatically with Items at the Loaded event.
This works fine in case of the UserControl at which the Ribbon is contained is one of the first controls to be displayed. If it is one later initialized then it might fail to add items programmatically. In my case it fails always, because I am using a tab control to split several application parts and at the last tab the Ribbon is contained and this tab is only callable when the webservice call was successful.
The issue can be easily reproduced when trying to programmatically edit the GalleryTool.Items collection after a button click. Please look at the attachment where I have prepared a Visual Studio Solution.
I need some hints how I can resolve this issue. Any other hint how to put some dynamic content at the ribbon to let the end user choose one of the provided items is also very appreciated.
Thanks.
RegardsJohannes
Hi Johannes,
Thanks for reporting this issue.This is definitely a bug in the control and we'll strive for fixing it for our next Service Release, which is scheduled for early next week.
As a "workaround" you could try to add the GalleryItems before the GalleryToolControl is generated, which means before the GalleryTool is rendered for the first time.
For example, in the scenario that you described:
jtwspg said: In my case it fails always, because I am using a tab control to split several application parts and at the last tab the Ribbon is contained and this tab is only callable when the webservice call was successful.
In my case it fails always, because I am using a tab control to split several application parts and at the last tab the Ribbon is contained and this tab is only callable when the webservice call was successful.
If you populate the GalleryTool when the webservice call succeeds and then allow access to the last tab, it should be working fine.
Another workaround would be to delay the creation of the GalleryTool until the items are available. You could create the GalleryTool in code-behind when the list of items comes from the service, add the items to the GalleryTool and then add the GalleryTool to the Ribbon.
Hope this helps,
Thanks for your quick answer. I appreciate that you try to fix it for the next Service Release. Would be great.
The workaround you describe I already tried. So i cut off the existing GalleryTool and created a new instance and inserted it to the position of the deleted one. There were no exceptions reported but the preview pane will simply show nothing (it seems that the MinPreviewCount is recognized as 0). I also tried to enforce the MinPreviewCount of the new GalleryTool to 4, but with no effect.
No matter if the existing GalleryTool is used (with try-catch the Exceptions) or use a new instance of GalleryTool, it is always possible to select the items at the drop down box of the GalleryTool.