I have a MenuTool that is a checkbox and then a listbox of subcategories checkboxes. My problem is that the MenuTool closes once anything is clicked in my itemtemplate area. I would like it to stay open until they click the MenuTool header again or the element loses focus. Is there a way to do this?
<igRibbon:MenuTool Caption="Segments" Grid.Row="0" Grid.Column="1" ItemsSource="{Binding SampleSegmentOptions}"> <igRibbon:MenuTool.ItemTemplate> <DataTemplate> <StackPanel> <CheckBox IsChecked="False" IsThreeState="True" Content="{Binding SegmentLabel}" /> <ListBox ItemsSource="{Binding SegmentCategories}" Margin="15,0,0,0" BorderThickness="0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"> <ListBox.ItemTemplate> <DataTemplate> <CheckBox IsChecked="False" Content="{Binding}" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </StackPanel> </DataTemplate> </igRibbon:MenuTool.ItemTemplate> </igRibbon:MenuTool>
Also, There seems to be some padding or margin on the left and right that I would like to get rid of.
Thank you!
Hello Jon,
To keep the menu-tool open you can handle the Click event of the CheckBoxes in the ItemTemplate. In the event handler, call MenuTool.IsOpen = true.
Regarding the padding or margin in the menu-tool, I am not entirely sure what you mean. Could you please provide some more details on what exactly you would like removed or how you would like your menu tool to look?
Please let me know if you have any questions or concerns.
Sincerely,AndrewDeveloper Support IInfragistics Inc.www.infragistics.com/support
https://www.dropbox.com/s/bcyii0dkafxsdw9/segments2.png
Here is an example of the space I'm trying to get rid of.
The click event works perfectly. Which event would you handle on the listboxitem to have the same effect?
The best option to get the MenuTool to remain open when clicking on a list box item is to create a Style for igRibbon: ToolMenuItem and use an EventSetter to handle the Click event. In that click event call MenuTool1.IsOpen = true.
Regarding the space on the menu, I am still researching a method to only have the MenuTool’s content show up. I believe it will have to be done by modifying the default styles of the XamRibbon. I will update you as soon as I have more information regarding that.
To remove the menu tool’s extra space, I wrote a Style for the ToolMenuItem and then used a setter and a ControlTemplate to set the Template property. The XAML in the style looks similar to the below:
<Setter Property=”Template”> <Setter.Value> <ControlTemplate> …
I have attached a sample to demonstrate.
Almost there.
The only issue now is that the controltemplate is in the resources and doesn't have the right datacontext (it is looking for listbox level bindings instead of listboxitem bindings).
I think it will work perfectly if you can help me with that last little piece.