Caption visibility

6 posts, 0 answers
  1. MANLEY HAYE
    MANLEY HAYE avatar
    6 posts
    Member since:
    Mar 2006

    Posted 07 Nov 2006 Link to this post

    I cannot seem to set the caption visibility of any of the dock controls:
    Dock Panel, DockUserControl or any of the properties,
    CloseButtonVisible, TabStripVisible, they are always showing.
    Help please as your documentation refers to ToolWindows which is not in your obejct library.
  2. Chris
    Admin
    Chris avatar
    221 posts

    Posted 08 Nov 2006 Link to this post

    Hi Manley,
    The ToolWindow is now replaced by the DockPanel and you can use the following properties to customize the dockpanel behavior:
    TabStripVisible, HideButtonVisible, DropDownButtonVisible, CloseButtonVisible, CaptionVisible.
    All these properties will be properly documented for the Service Pack 1 which is about to be released in 2 weeks. Other than that I recommend you download the fixed build which we uploaded today and where we fixed some docking problems mostly related to persisting changes done in design-mode.

    Best wishes,
    Chris
    the telerik team
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Daniel Plomp
    Daniel Plomp avatar
    130 posts
    Member since:
    Feb 2004

    Posted 10 Aug 2007 Link to this post

    Hi Telerik,

    I've just the question if it is possible to hide the 'tab' on a TabbedDocument. I can't hide the tab nor the Close or Pin button(s).

    What is it I'm doing wrong?

    Thanks,
    Daniel
  5. Boyko Markov
    Admin
    Boyko Markov avatar
    610 posts

    Posted 10 Aug 2007 Link to this post

    Hi Daniel,

    Yes, this is possible. To hide the close button or the tab on a TabbedDocument you will have to access the children collection of the DockPresentationElement, which is a child of the DockPresentationControl's RootElement (the one you actually see).

    By default the DockPresentationElement has three children in its collection. The important child is the third one, which is an instance of DockPresenterLayout which is a container of  DockContentPrimitive and ForceSizeLayoutPanel.

    Let's focus on the ForceSizeLayoutPanel which contains a StripLayoutPanel and in that strip there are instances of CaptionLayout and LinePrimitive. As you see, you will have to play a bit with the children collections of the elements in your DockPresentationControl. The CaptionLayout's purpose is to be a container of all caption elements which in our case are instances of RadTabStripElement, CaptionButton and a DropDownButton i.e as you access these elements you will have control of all their properties. To hide an element you could use the Visibility property which you could set to one of the three states - ElementVisibility.Hidden, ElementVisibility.Collapsed or ElementVisibility.Visible.

    I hope this helps. Please feel free to write us if you have any further questions.


    Best wishes,
    Ray
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Daniel Plomp
    Daniel Plomp avatar
    130 posts
    Member since:
    Feb 2004

    Posted 13 Aug 2007 Link to this post

    Hello Ray,

    Thanks for the explanation about the TabDocument.
    However, I'm having some trouble finding the right collection.

    I suppose I'll have to look it up somewhere from code as it isn't present in the designer?
    Could you maybe help me out with a code sample?

    Thanks,
    Daniel
  7. Boyko Markov
    Admin
    Boyko Markov avatar
    610 posts

    Posted 13 Aug 2007 Link to this post

    Hi Daniel,

    You can use the example code from the TabbedDocument example in the RadDock section in our QSF which is shipped with our controls suite.

    The following code snippet shows how to access and then hide the caption button, close button and tab strip from a new created tabbed document.

    C#
        Telerik.WinControls.Docking.CaptionButton caption = ((DocumentPresenterControl)documentPane.DefaultPresenter).DocumentPresenterElement.CommandPanel.Children[0].Children[1] as Telerik.WinControls.Docking.CaptionButton;  
                RadDropDownButtonElement ddButton = ((DocumentPresenterControl)documentPane.DefaultPresenter).DocumentPresenterElement.CommandPanel.Children[0].Children[2] as RadDropDownButtonElement;  
                RadTabStripElement tabStrip = ((DocumentPresenterControl)documentPane.DefaultPresenter).DocumentPresenterElement.TabStripElement;  
     
                tabStrip.Visibility = Telerik.WinControls.ElementVisibility.Hidden;  
                ddButton.Visibility = Telerik.WinControls.ElementVisibility.Hidden;  
                caption.Visibility = Telerik.WinControls.ElementVisibility.Hidden;  
         

    VB .NET
    Dim caption As Telerik.WinControls.Docking.CaptionButton = TryCast((CType(documentPane.DefaultPresenter, DocumentPresenterControl)).DocumentPresenterElement.CommandPanel.Children(0).Children(1), Telerik.WinControls.Docking.CaptionButton)  
                Dim ddButton As RadDropDownButtonElement = TryCast((CType(documentPane.DefaultPresenter, DocumentPresenterControl)).DocumentPresenterElement.CommandPanel.Children(0).Children(2), RadDropDownButtonElement)  
                Dim tabStrip As RadTabStripElement = (CType(documentPane.DefaultPresenter, DocumentPresenterControl)).DocumentPresenterElement.TabStripElement  
     
                tabStrip.Visibility = Telerik.WinControls.ElementVisibility.Hidden  
                ddButton.Visibility = Telerik.WinControls.ElementVisibility.Hidden  
                caption.Visibility = Telerik.WinControls.ElementVisibility.Hidden  
     

    You could place that code in the newRadButton click event handler after the initialization of the DocumentPane initialization.

    I hope that this is helpful.


    Regards,
    Ray
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top
UI for WinForms is Visual Studio 2017 Ready