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
3220
xamMenuItem: Bind sub items MVVM
posted

Hello,

How to bind a collection to sub menu items, properly. I used the ItemsSource and the XamMenuItem.ItemContainerStyle. But it doesn't work as expected. Wrong Header Text and wrong hover style.

<ig:XamMenuItem Header="Recent Configurations ..." ItemsSource="{Binding RecentLoadedConfigs}">
                    <ig:XamMenuItem.Icon>
                        <Image Source="/Resources/Icons/OpenFolder_16x.png"></Image>
                    </ig:XamMenuItem.Icon>
                    
                    <ig:XamMenuItem.ItemContainerStyle>
                        <Style TargetType="ig:XamMenuItem">
                            <Setter Property="Header" Value="{Binding Header}"/>
                            <Setter Property="Command" Value="{Binding ClickCommand}"/>
                        </Style>
                    </ig:XamMenuItem.ItemContainerStyle>
                </ig:XamMenuItem>