This project is read-only.

RibbonGroupBox ItemsSource DataTemplate and ReduceOrder

Feb 10, 2011 at 6:26 PM
Hi,

I am evaluating Ribbon Control Suite for our large MVVM project (15 Developers, 7 modules). The control is great except for this serious bug (for us), This is my code snippet,

<RibbonControlGroupBox x:Name="rgbGlobalActionsList" ItemsSource="{Binding ActionsList}" ItemTemplate="{StaticResource RibbonListItemTemplate}" />

<ItemTemplate x:Key="RibbonListItemTemplate">
<DataTemplate>
<Fluent:Button Header="{Binding DisplayName}" Icon="{Binding Icon}" LargeIcon="{Binding LargeIcon}" Command="{Binding Command}" />
</DataTemplate>
</ItemTemplate>

Everything works fine if I do not include this groupBox's name in the TabItem's reduceOrder property. The moment I add it to the ReduceOrder property and I resize the window, the app crashes and I get a big exception saying Fluent.dll is unable to cast the object from UIExtensionPointInfo (which is my datatype for the item) to UIElement.

This is a serious error that is a show stopper.

(PS: A more minor issue is that RibbonTabItem extends Control and not ItemsControl so I cannot attach ItemsSource to the tabitem and let it create RibbonGroups using a data template.)

Please let me know what the workaround is for this bug or is there a patch of any kind to fix this.

Thanks,
Harish.

 

Feb 11, 2011 at 7:37 PM

I think the fact that RibbonTabItem not extending ItemsControl is a big issue; especially in a MEFed app. 

Feb 12, 2011 at 12:29 AM

Oh I agree but I am downplaying it for this as I can create groups and attach ItemsSource to each groups. It is an ugly solution but at least it doesn't blow up with an exception. I would love to simply attach ItemsSource to RibbonTabItem with a itemtemplate and a datatemplate and create a perfect MVVM solution. But the reduce order throwing an exception and not working is a big show stopper. I am now thinking of evaluating Microsoft WPF ribbon which supports all of the above but looks UGLY. Seriously, they even removed any theme that came with the previous release not to mention they are still stuck in the Office 2007 stylwewith no minimize and backstage functionalities.

Feb 22, 2011 at 7:22 PM

This is a deal breaker for us so we switched to the Microsoft WPF Ribbon which has complete MVVM and theming support. But your control is very promising and keep up the good work!

Feb 23, 2011 at 1:26 AM

I switched from the WPF Ribbon because of the lack of out of the box support for saving/restoring the QAT state.  The demo shows how they implemented it, but it didn't do much for me.  Btw - you could get the fluent source, find the exception and fix it.  I'm sure the fluent people would appreciate it. 

Feb 23, 2011 at 2:08 PM

Fixing it isnt that simple for us because everything for us needs to come from lists and datat emplates with the xaml and code behind completely empty. This means the tab control needs to extends from ItemsControl as well as the ribbon. I tried to look int othe code to fix it to see how simple the restore order problem will be and its not easy. The restroe order needs the name of the group boxes to restore which we don't and never will have in code. I spent a day on it but that was about the time I had. But this is a promising tool and I would certainly use it non-MVVM projects.

Feb 24, 2011 at 12:49 AM
Edited Feb 24, 2011 at 1:09 AM

Mahadevanh, I meant fixing the exception. And to that end, I really didn't understand the problem.

As far as MVVM, we populate the Ribbon through code rather than xaml, and that may suggest that there should be a separation between the code and the xaml, however this really isn’t an instance of Model and View. After all, the coded RibbonTabItems and RibbonGroupBoxes really ARE part of the Ribbon View and not part of a Model, so this really doesn't violate the MVVM pattern. 

I know I said I thought the fact that the Ribbon and the Tabs collection were not ItemsControls was a big issue for MEF'd applications, but after thinking about it, it really isn’t that much of a bother to have to iterate through the coded tabs and groups to add them. Our app is still able to MEF the tab and group components in, the collections just aren't databound to the control.