C1DockControl hidden tabs

Posted by: abellisomi on 25 March 2020, 11:55 am EST

  • Posted 25 March 2020, 11:55 am EST

    Hello,
    I haven't been able to find a way to reinstate or manage hidden tabs, so I have been trying to prevent users from hiding or close tabs.
    However in some scenario, the Hide button (x on the top right) keeps popping out. This is my configuration:


    <c1:C1DockControl AllowDrop="False" >
    <c1:C1DockGroup DockMode="Docked">
    <c1:C1DockTabControl DockMode="Docked" Dock="Bottom" TabItemClose="None" CanUserHide="False" CanUserDock="True" CanUserSlide="False" CanUserFloat="True" CanUserReorder="False">
    <c1:C1DockTabItem Header="Main1" TabShape="Sloped" CanUserClose="False" CanUserPin="False" >
    ...
    </c1:C1DockTabItem>
    <c1:C1DockTabItem Header="Main2" TabShape="Sloped" CanUserClose="False" CanUserPin="False">
    <c1:C1DockControl AllowDrop="True">
    <c1:C1DockTabControl DockMode="Docked" Dock="Bottom" TabItemClose="None" CanUserHide="False" CanUserDock="True" CanUserSlide="False" CanUserFloat="True" CanUserReorder="False">
    <c1:C1DockTabItem Header="Tab1" TabShape="Sloped" CanUserClose="False" CanUserPin="False">
    ...
    </c1:C1DockTabItem>
    <c1:C1DockTabItem Header="Tab2" TabShape="Sloped" CanUserClose="False" CanUserPin="False">
    ...
    </c1:C1DockTabItem>
    </c1:C1DockTabControl>
    </c1:C1DockControl>
    </c1:C1DockTabItem>
    </c1:C1DockTabControl>
    </c1:C1DockGroup>
    </c1:C1DockControl>


    Is there anything I could do to prevent users from hiding or closing tabs?
  • Marked as Answer

    Replied 25 March 2020, 10:49 pm EST

    Hello,

    Upon primary testing for your code, I did not find a scenario where the Hide button popped up. However, there is one another way you can do it.
    Deactivate:
    var setter = (Setter)_tab1.Style.Setters.Where(x => "Template".Equals(((Setter)x).Property.Name)).FirstOrDefault();
    var controlTemplate = (ControlTemplate)setter.Value;
    var button = (Button)controlTemplate.FindName("HiddenButton", _tab1);
    if (button == null)
    return;
    button.IsEnabled = false; //if you want to show but disable it
    button.Visibility = Visibility.Collapsed; //if you do not want to even show it
    See if it works better for you.

    Regards,
    Ruchir
    WPF_CanUserHide.zip
  • Replied 25 March 2020, 10:50 pm EST

    That might work.
    Is there any way to show again hidden tabs?
  • Replied 25 March 2020, 10:59 pm EST

    Hi,

    Yes, I have included the code for re-activation as well in the attached application. Please refer the attachment shared earlier.

    ~Ruchir
Need extra support?

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

Learn More

Forum Channels