hi,
is it possible to have a usercontrol in a XamRibbonTabItem or XamRibbonGroup? can you please point to some sample code on this?
thanks.
Hello,
Thank you for your post. I have been investigating the functionality that you are looking for and I can suggest creating a custom tool and add it in a RibbonGroup. You can add the user control that you wish to display in the template for that custom tool. I have created a sample application for you that demonstrates how you can implement this approach.
Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
thank you for the quick reply and the solution works.
how does the interaction between usercontrol and xamribbon work as the user control is now in a controltemplate. is it possible to get the instance of xamribbon in the usercontrol and is it possible to get instance of usercontrol in xamribbon?
I have been looking into your reply and I have modified the sample application in order to demonstrates how you can access the UserControl through the XamRibbon and the XamRibbon through the UserControl. To do that I have added a property to the UserControlRibbonTool form type RibbonToolUserControl and initialize it. In the Template for the UserControlRibboToolControl, I have changed the UserControlRibboToolControl with a ContentControl and bound its Content to the property form type UserControlRibboToolControl that I have added to the custom tool. By doing so you can access the UserControl through the custom tool and the XamRibbon. Also I have bound the Tag property of the ContentControl that holds the RibbonToolUserControl, to the UserControlRibboToolControl’s Tool.Ribbon property and by doing so you can access the XamRibbon in the user control.
Hello Tuan and Aneesh,
Thank you for your replies.
Tuan,
I have been looking into the issue that you have described and the reason for the UserContorls to not show in the ChildWindow is that the default style of the custom ribbon tool is defined in the MainPage and the ChildWindow is a popup, which is have different scope and it cannot use the resources of the MaiPage, which results in the custom ribbon tool to have no template. In order to avoid this issue, you can move the default style for the custom tool to the Resources of App.xaml.
Aneesh,
The reason for the user controls to not be fully visible when they have larger height is that the XamRibbon is designed to have specific height and it does not increase its size if there is a content with height more than its. In order to allow the XamRibbon to take more height, you can re-template the XamRibbon and increase the height of the GroupArea Grid, which is part of the Template of the Ribbon. You can get the default style for the XamRibbon from your Infragistics folder. The default path is:
C:\Program Files (x86)\Infragistics\NetAdvantage 2013.1\Silverlight\DefaultStyles\XamRibbon\ generic.xaml
I am also attaching a screenshot of Silverlight Spy, which shows the element that I am referring to.
Krasimir, MCPD
Developer Support Supervisor - XAML
I found issue in setting height of control. If my custom control's height is more then it gets hidden partially.. Is there a way to set height of XAM ribbon group in order to display cutom control in full if height of custom control is more?
Hi, thank you for you reply. I created ribbon menu with usercontrol. But I created that to child window, and when load the popup againin the second time, it didn't load usercontrol.
I am just checking if you require any further assistance on the matter.
Thank you for your feedback. The XamRibbon control is not designed to be host for controls and UserControls, it is supposed to host RibbonTools in it and this is the reason that I have created the approach that I have provided you, with implementing the custom RibbonTool that allows you to add different UserControl as its visual representation. I have been testing the sample application that I have provided you with and, currently I have found no issues with the implementation. If you are using this approach with many UserControls in the XamRibbon, there should not be any issues.
Please let me know if you need any further assistance while implementing the XamRibbon with UserControls.