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
65
How to popup a Usercontrol from the ribbon
posted

Dear Support,

actually we are in the decisionprocess between ActiPro + XCeed or Infragistics.
For the time being we don't find your sparely onlinehelp very useful, so maybe you can give us some hints. Even for the ToolProxy there is nealy no help, except your statement "you don't need this if your are not developing your own controls". Great. Really. Was rolling laughin on the floor....

We would like to have a Button with this small arrow in the ribbon (called at IG MenuTool).
After pressing the button we would like to have a usercontrol popped up, below the button.

With Actipro it's quite easy, cause they use some "PopupButton" which pops up nearly everything.

But your MenuTool puts our Control within a Menu which looks really terrible.
We would like to have a solution for this in XAML only, without any coding. And it would be great if the usercontrol could be resizeable by the user without any addional coding or changing the UserControl itself.

Furthermore we would like to know, when you will support the Scenic-Ribbon-style.
Someone asked in July but there is still no reply from your end.

Thank you very much in advance for your soon reply.
Bst rgds,

Jens D.

PS: I mean something like

 

<igRibbon:MenuTool>
     <igRibbon:ResizeablePopupControl>

           <myProject:MyUsercontrol/>
      </igRibbon:ResizeableWindowControl>

</igRibbon:MenuTool>

Parents
  • 54937
    Verified Answer
    Offline posted

    Jens23 said:
    But your MenuTool puts our Control within a Menu which looks really terrible.
    We would like to have a solution for this in XAML only, without any coding.

    The default behavior is to put an element in the header area of the menu item. This would make sense in a situation where you have other menu items and you put something like a textbox into the menu. However for your scenario this obviously isn't what you want. This should probably be made easier in a future version but for now I can think of two options. One is to put a ToolMenuItem in the items where the Header contains your control and the tempalte of the TMI is set to a simple ContentPresenter. e.g.

    <igRibbon:XamRibbon DockPanel.Dock="Top">
        <igRibbon:XamRibbon.Resources>
            <ControlTemplate TargetType="{x:Type igRibbon:ToolMenuItem}" x:Key="FillItemTemplate">
                <ContentPresenter ContentSource="Header" />
            </ControlTemplate>
        </igRibbon:XamRibbon.Resources>
        <igRibbon:RibbonTabItem Header="Home">
            <igRibbon:RibbonGroup Caption="Sample">
                <igRibbon:MenuTool Caption="Custom MenuItem">
                    <igRibbon:ToolMenuItem 
                        MinWidth="100" MinHeight="100"
                        Template="{StaticResource FillItemTemplate}">
                        <igRibbon:ToolMenuItem.Header>
                            <TextBox AcceptsReturn="True" />
                        </igRibbon:ToolMenuItem.Header>
                    </igRibbon:ToolMenuItem>
                </igRibbon:MenuTool>
            </igRibbon:RibbonGroup>
        </igRibbon:RibbonTabItem>
    </igRibbon:XamRibbon>

    Another option would be to have a custom tool that wraps the object you want to host in the dropdown that tells the ribbon that this item should fill the entire area. e.g.

    <igRibbon:XamRibbon DockPanel.Dock="Top">
        <igRibbon:XamRibbon.Resources>
            <ControlTemplate TargetType="{x:Type igRibbon:ToolMenuItem}" x:Key="FillItemTemplate">
                <ContentPresenter ContentSource="Header" />
            </ControlTemplate>
        </igRibbon:XamRibbon.Resources>
        <igRibbon:RibbonTabItem Header="Home">
            <igRibbon:RibbonGroup Caption="Sample">
                <igRibbon:MenuTool Caption="Custom MenuItem">
                    <igSample:MenuItemWrapper 
                        xmlns:igSample="clr-namespace:Infragistics.Samples"
                        MinWidth="100" MinHeight="100">
                        <DockPanel>
                            <TextBox AcceptsReturn="True" />
                        </DockPanel>
                    </igSample:MenuItemWrapper>
                </igRibbon:MenuTool>
            </igRibbon:RibbonGroup>
        </igRibbon:RibbonTabItem>
    </igRibbon:XamRibbon>
    namespace Infragistics.Samples
    {
    public class MenuItemWrapper : ContentControlIRibbonTool
    {
    #region Constructor
    static MenuItemWrapper()
    {
    MenuItemWrapper.DefaultStyleKeyProperty.OverrideMetadata(typeof(MenuItemWrapper), new FrameworkPropertyMetadata(typeof(MenuItemWrapper)));
     
    // simple template of just a content presenter
    ControlTemplate ct = new ControlTemplate(typeof(MenuItemWrapper));
    FrameworkElementFactory fef = new FrameworkElementFactory(typeof(Border));
     
    fef.SetValue(BackgroundProperty, new TemplateBindingExtension(BackgroundProperty));
    fef.SetValue(BorderBrushProperty, new TemplateBindingExtension(BorderBrushProperty));
    fef.SetValue(BorderThicknessProperty, new TemplateBindingExtension(BorderThicknessProperty));
    fef.SetValue(Border.PaddingProperty, new TemplateBindingExtension(MenuItemWrapper.PaddingProperty));
    fef.SetValue(SnapsToDevicePixelsProperty, true);
     
    FrameworkElementFactory fefCP = new FrameworkElementFactory(typeof(ContentPresenter));
    fefCP.SetValue(SnapsToDevicePixelsProperty, new TemplateBindingExtension(SnapsToDevicePixelsProperty));
     
    fef.AppendChild(fefCP);
    ct.VisualTree = fef;
    MenuItemWrapper.TemplateProperty.OverrideMetadata(typeof(MenuItemWrapper), new FrameworkPropertyMetadata(ct));
    #endregion //Constructor
     
    #region IRibbonTool Members
     
    RibbonToolProxy IRibbonTool.ToolProxy
    {
    get { return MenuItemWrapperProxy.Instance; }
    }
     
    #endregion //IRibbonTool Members
     
    #region MenuItemWrapperProxy
    protected class MenuItemWrapperProxy : RibbonToolProxy<MenuItemWrapper>
    {
    internal static readonly RibbonToolProxy Instance = new MenuItemWrapperProxy();
     
    protected override ToolMenuItemDisplayMode GetMenuItemDisplayMode(MenuItemWrapper tool)
    {
    return ToolMenuItemDisplayMode.UseToolForEntireArea;
    }
     
    public override bool CanAddToQat
    {
    get
    {
    return false;
    }
    }
    #endregion //MenuItemWrapperProxy
    }
    }

    Jens23 said:
    And it would be great if the usercontrol could be resizeable by the user without any addional coding or changing the UserControl itself.

    Unfortunately this isn't supported currently. I'll submit a suggestion about adding this in a future version.

    Jens23 said:
    Furthermore we would like to know, when you will support the Scenic-Ribbon-style. Someone asked in July but there is still no reply from your end.

    This appears to be essentially styling differences but I don't think MS has released any updates to the UI guidelines so I don't know when such a style would be available right now.

     

Reply Children
No Data