ToolMenuItem Command is not working. Where it is wrong??
<igRibbon:MenuTool Caption="Export" SmallImage="Export16.png" LargeImage="Export32.png"> <igRibbon:ToolMenuItem Header="Export Selected" Command="{Binding Path=ExportWidget}"> <igRibbon:ToolMenuItem.Icon> <Image Source="Export32.png" /> </igRibbon:ToolMenuItem.Icon> </igRibbon:ToolMenuItem> <igRibbon:ToolMenuItem Header="Export All" Command="{Binding Path=ExportWidget}"> <igRibbon:ToolMenuItem.Icon> <Image Source="Export16.png" /> </igRibbon:ToolMenuItem.Icon> </igRibbon:ToolMenuItem> </igRibbon:MenuTool>
I used the ButtonTool control in place of ToolMenuItem, which works for me.
Thanks.
Hello Gajender,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Hello,
Thanks Stefan.Turns out it was my error.My DataTemplate for the items in the collection should have had the Command binding on it, not the style for the ToolMenuItem.
I found that I could not assign the ToolMenuItem as the visual in the DataTemplate, so used ToggleButtonTool.
<DataTemplate DataType="{x:Type entities:SearchField}"> <igRibbon:ToggleButtonTool Id="{Binding SerializationId}" Command="{Binding FocusSearchFieldCommand, ElementName=Window}" CommandParameter="{Binding}" Caption="{Binding Id, Converter={StaticResource nameConverter}}" IsChecked="{Binding IsChecked, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type igRibbon:ToolMenuItem}}}" /> </DataTemplate>
Thank you for your post. I have been looking into it and I created a sample project for you following your scenario and everything seems to work ok on my side. If the sample doesn’t satisfies all your needs feel free to modify it, so it reproduces your behavior and send it back to me for further investigation.
Looking forward for your reply.
I have the same problem but I must use ToolMenuItem.
In my case I have a MenuTool with ItemsSource bound to a collection. I have a Style for ToolMenuItem with IsChecked bound to a property on the item. I need to execute a command when the ToolMenuItem is clicked, not on Checked because other business logic can check/uncheck the item under the hood. In which case I do not execute the command.
It does not seem to raise Click or MouseUp event or execute a Command. I was able to confirm that the Command binding was working correctly, but the Execute would never be called. It does raise the Checked event, but as mentioned before that does not meet my requirements.
Does ToolMenuItem suppress these events?
<Style TargetType="{x:Type igRibbon:ToolMenuItem}" BasedOn="{StaticResource {x:Type igRibbon:ToolMenuItem}}">
<Setter Property="IsChecked" Value="{Binding IsChecked, Mode=TwoWay}" />
<EventSetter Event="Click" Handler="OnToolMenuItemClick" />
<Setter Property="Command" Value="{Binding FocusSearchFieldCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" />
<Setter Property="CommandParameter"
Value="{Binding}" />
Style>