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
80
How to bind items to a menu tool?
posted

I'd like to have a menu tool containing a dynamic list of radio button tools.

I've made a little example to illustrate the problem:

 <Window x:Class="InfraSandbox.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Ribbon="clr-namespace:Infragistics.Windows.Ribbon;assembly=Infragistics3.Wpf.Ribbon.v8.2"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    Title="Window1" Height="300" Width="300">
    <Window.Resources>
        <x:Array x:Key="data" Type="System:String">
            <System:String>B1</System:String>
            <System:String>B2</System:String>
            <System:String>B3</System:String>
        </x:Array>
    </Window.Resources>
    
    <Grid>        
        <Ribbon:XamRibbon>
            <Ribbon:RibbonTabItem Header="Tab">
                <Ribbon:RibbonGroup Caption="Group">
                    <Ribbon:MenuTool Caption="MenuTool 1">
                        <Ribbon:RadioButtonTool Caption="A1" IsChecked="True"/>
                        <Ribbon:RadioButtonTool Caption="A2"/>
                        <Ribbon:RadioButtonTool Caption="A3"/>
                    </Ribbon:MenuTool>

                    <Ribbon:MenuTool Caption="MenuTool 2" ItemsSource="{StaticResource data}">
                        <Ribbon:MenuTool.ItemTemplate>
                            <DataTemplate>
                                <Ribbon:RadioButtonTool Caption="{Binding Path=.}"/>
                            </DataTemplate>
                        </Ribbon:MenuTool.ItemTemplate>
                    </Ribbon:MenuTool>
                </Ribbon:RibbonGroup>
            </Ribbon:RibbonTabItem>
        </Ribbon:XamRibbon>
    </Grid>
</Window>


Is it possible to do it this way?