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
45
Using WindowsFormsHost in the XamRibbon in a MenuTool
posted

I´m trying to use a WindowsFormsHost in a MenuTool in the Ribbon Control, but the WindowsFormsControl is not displayed. (If I place the WindowFormsHost under the RibbonGroup it is working correct.)

Here is a code sample (a reference to WindowsFormsIntegration and System.Windows.Forms must be set in the project settings):

xmlns

 

 

:winform="clr-amespace:System.Windows.Forms;assembly=System.Windows.Forms"

...

<igRibbon:XamRibbon>

 <igRibbon:RibbonTabItem Header="Start">

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   <igRibbon:RibbonGroup Caption="Test">

 

 

 

 

     <igRibbon:MenuTool Width="100">

 

 

 

 

       <WindowsFormsHost Width="100" Height="50" Background="LightBlue"       

           Margin="3">

 

 

 

 

              <winform:Button Text="TestButton" ></winform:Button>

 

 

 

 

 

       </WindowsFormsHost>

 

 

 

 

 

     </igRibbon:MenuTool>

 

 

 

 

 

     <WindowsFormsHost Width="100" Height="50" Background="LightBlue"

           Margin="3">

 

 

 

 

 

         <winform:Button Text="TestButton" ></winform:Button>

 

 

 

 

 

     </WindowsFormsHost>

 

 

 

 

 

</igRibbon:RibbonGroup>

 

 

 

 

 

</igRibbon:RibbonTabItem>

Parents
No Data
Reply
  • 138253
    Offline posted

    Hello,

     

    It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. So I have been looking through your post and I created a sample project for you. I basically create a template for a CustomTool class in which a put a WindowsFormsHost with a Button inside. I did that because in the MenuTool of the XamRibbon you can put only tool elements and if you want to put a custom control you can implement IRibbonTool interface and create the custom tool.

     

    Feel free to write me if you have any other questions.

    XamRibbonWindowsFormsHost.zip
Children
No Data