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
860
How to use xamRibbon MenuTool in MVVM
posted

This question is related to the question at: http://es.infragistics.com/community/forums/t/86353.aspx

I am also trying to use the MenuTool in MVVM. Trying to do what the original poster likes to do, I looked through all the suggested threads, however, I was not able to get the MenuTool to work.

Here's the XAML:

<igRibbon:MenuTool  Caption="Status" ItemsSource="{Binding MenuItems}">
    <igRibbon:MenuTool.ItemContainerStyle>
        <Style TargetType="{x:Type igRibbon:ToolMenuItem}">
            <Setter Property="Command" Value="{Binding SetStatusCommand}"/>
            <Setter Property="CommandParameter" Value="{Binding}"/>
        </Style>
    </igRibbon:MenuTool.ItemContainerStyle>
</igRibbon:MenuTool>

Here's the VM:

public class ViewModel:ViewModelBase

{

public ViewModel()

{

MenuItems = new ObservableCollection<string> { "Active", "InActive", "Test" };

SetStatusCommand = new DelegateCommand<string>(SetStatus);

}

public DelegateCommand<string> SetStatusCommand { get; set; }

private ObservableCollection<string> _MenuItems;
public ObservableCollection<string> MenuItems
{
       get { return _MenuItems; }
       set
       {
             if (value != _MenuItems)
            {
             _MenuItems = value;
             RaisePropertyChanged();
            }
        }
}

private void SetStatus(string status)
{
       var parameter = status;
}

}

When I click on the item from the menu drop-down, the SetStatusCommand was not fired.

What did I do wrong?

If you can prepare a simple sample showing how to use the MenuTool in MVVM will be a great help.

Thank you very much.