RibbonMenuItem DataBinding

Apr 3, 2009 at 2:12 PM

Hi,
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}"/>
</Style>


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" />
</Style>

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

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

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

<r:RibbonDropDownButton
                        Name="LoadTemplate"
                        Command="{StaticResource dLoadTemplate}"
                        Style="{DynamicResource TemplateDropDown}"
                        DataContext="{Binding Path=.}"
                        ItemsSource="{Binding}"
                        >
</r:RibbonDropDownButton>

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

Thanks in Advance.
G.

Developer
May 16, 2013 at 1: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/