RibbonMenuItem DataBinding

Apr 3, 2009 at 1:12 PM

I'm working with Ribbon bar and I had a problem with the construction of a menu, filled via databinding.
I try to fill a RibbonMenuItem of  RibbonDropDownButton control  with some data of databing.
My problem is that the databinding creates a own MenuItem element that overlaps with the classic style of  RibbonMenuItem.

Here there's the xaml code style that I apply to the RibbonDropDownButton:

<Style x:Key="TemplateDropDown" TargetType="{x:Type r:RibbonDropDownButton}">
<Setter Property="ItemTemplate" Value="{DynamicResource ItemsTemplate}" />
<Setter Property="ItemContainerStyle" Value="{DyinamicResource mnuTemplateSelection}"/>

Than I create the style to assing an event for each item in the menu. 

<Style x:Key="mnuTemplateSelection" TargetType="{x:Type r:RibbonMenuItem}" >
<EventSetter Event="MouseLeftButtonDown" Handler="mnuTemplateSelectionClick" />

Here I fill the Menu that I want to visualize in the RibbonMenuItem

<DataTemplate x:Key="ItemsTemplate" >
 <r:RibbonMenuItem Header="{Binding Path=templateName}" />

Here there's the xaml of RibbonDropDownButton that appear in my RibbonBar.

                        Command="{StaticResource dLoadTemplate}"
                        Style="{DynamicResource TemplateDropDown}"
                        DataContext="{Binding Path=.}"

In this way the style menu item that create the databinding overlpas with the RibbonMenuItem's style.

Thanks in Advance.

May 16, 2013 at 12:26 PM
Hi, a new version of Ribbon is released. Please visit the new site for latest fixes, releases, information and downloads.
New site: http://officeribbon.codeplex.com/