Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
495
Problem with binding of the Caption property of nested MenuTool
posted

Hi,

I'm trying to bind the ItemSource of a MenuTool to a XmlDataProvider.

There seems to be a problem when the MenuTool is inside another MenuTool which prevents the Caption from showing.

I wrote a simple example that demonstrates the issue.

Xaml:

<Window x:Class="XmlMenuToolDemo.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ribbon="http://infragistics.com/Ribbon"
        Title="Window1" Height="300" Width="300">
    <Window.Resources>
        <XmlDataProvider Source="data.xml" XPath="Groups/Group" x:Key="data" />
        <DataTemplate DataType="Group">
            <ribbon:MenuTool Caption="{Binding XPath=@name}" ItemsSource="{Binding}" />
        </DataTemplate>
        <DataTemplate DataType="Entity">
            <ribbon:ButtonTool Caption="{Binding XPath=@name}" />
        </DataTemplate>
    </Window.Resources>
    <StackPanel>
        <ribbon:XamRibbon>
            <ribbon:RibbonTabItem>
                <ribbon:RibbonGroup Name="ribbonGroup1" ItemsSource="{Binding Source='{StaticResource data}'}"/>
                <ribbon:RibbonGroup Name="ribbonGroup2">
                    <ribbon:MenuTool Name="menuTool" />
                </ribbon:RibbonGroup>
            </ribbon:RibbonTabItem>
        </ribbon:XamRibbon>
    </StackPanel>
</Window>

The xml file I use:

<?xml version="1.0" encoding="utf-8" ?>
<Groups>
  <Group name="group1">
    <Group name="group2" />
    <Entity name="entity" />
  </Group>
  <Group name="group3" />
  <Group name="group4">   
  </Group>
</Groups>