RibbonTab Owner

Originally Posted 10 February 2017, 12:16 pm EST

  • Originally Posted 10 February 2017, 12:16 pm EST

    Hi,
    i need to know if a RibbonTab is owned by any Contextual Group.
    Is there a way to get something like

    .GetOwner ?

    It is needed to let me know if i'm changing the selected RibbonTab from a "simple" ribbontab or a child one from a context group.
    Thanks

    Regards,
    Fabio La Vitola
  • Reply

    Hello Fabio,

    You can meet your requirement by using C1Ribbon's "SelectedTabChanged" event and inside it, check if any Contextual Group contains SelectedTab, if yes then SelectedTab is child of a Contextual Group else SelectedTab is a "simple" ribbontab.
    You may implement something like:
     foreach (RibbonContextualTabGroup tabGroup in C1Ribbon.ContextualTabGroups)
    {
    if (tabGroup.Tabs.Contains(C1Ribbon.SelectedTab))
    {
    currentOwner = tabGroup;

    MessageBox.Show(C1Ribbon.SelectedTab.Name + " owner: " + currentOwner.Name);
    count++;
    break;
    }
    }


    I have attached a simple sample application for reference.

    Let us know if this does meet your requirement.

    Regards
    Ruchir Agarwal
    2017/02/prj_RibbonTabParent.zip
  • Reply

    Hi Ruchir,
    thanks for your answer but even this time i've solved on my own...
    Anyway, i don't understand why such an important property like a "parent" (atm, the Contextual tab) is NOT available (but it is present in non exposed properties, attached file).
    Here's my solution (1 row code):

    If C1Ribbon1.SelectedTab.OwnerCollection.Equals(RibbonContextualTabGroup1.Tabs) Then
    MsgBox ("Belongs to " + RibbonContextualTabGroup1.Text
    End If


    Hope to that property exposed asap!
    THanks

    Regards,
    Fabio La Vitola

  • Marked as Answer

    Reply

    Hello Fabio,

    Good to know that you found the solution to the problem.
    I have also notified the development team to expose the discussed property.

    Regards
    Ruchir Agarwal
  • Reply

    Hi,

    Using the latest release build, owner of a tab can be returned on using Owner property.
    You can download the latest release build from here:

    http://prerelease.componentone.com/dotnet40/c1winforms/2017-t2/C1WinForms.4_4.0.20172.271.zip
    http://prerelease.componentone.com/dotnet20/c1winforms/2017-t2/C1WinForms.2_2.0.20172.271.zip

    Thanks,
    Esha
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels