How do I remove the close button from a RadDock documentwindow

10 posts, 0 answers
  1. Carol Ladson
    Carol Ladson avatar
    1 posts
    Member since:
    Aug 2007

    Posted 21 Jan 2010 Link to this post

    I thought this code would remove the close button from a documentwindow that is in a RadDock object.   It did not.   How do I remove the close button from the documentwindow?

    Code Snippet:
         this.documentWindow1.ToolCaptionButtons &= ~Telerik.WinControls.UI.Docking.ToolStripCaptionButtons.Close;
  2. Nikolay
    Admin
    Nikolay avatar
    1805 posts

    Posted 26 Jan 2010 Link to this post

    Hi Carol Ladson,

    The ToolCaptionButtons property is relevant to ToolWindows. However, if you want to set the available buttons of a DocumentWindow, please use the DocumentButtons property:
    this.documentWindow1.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtos.Close;

    I hope this helps. If you have additional questions, feel free to contact me.

    All the best,
    Nikolay
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Julien
    Julien avatar
    24 posts
    Member since:
    Nov 2008

    Posted 05 Feb 2010 Link to this post

    Ok and how do we remove the close button when the tool is floating?
  4. Nikolay
    Admin
    Nikolay avatar
    1805 posts

    Posted 09 Feb 2010 Link to this post

    Hello Julien,

    You can remove the close button of the floating window dynamically on the TransactionCommitted event:
    public Form1()
    {
        InitializeComponent();
      
        this.radDock1.TransactionCommitted += new Telerik.WinControls.UI.Docking.RadDockTransactionEventHandler(radDock1_TransactionCommitted);
    }
      
    void radDock1_TransactionCommitted(object sender, Telerik.WinControls.UI.Docking.RadDockTransactionEventArgs e)
    {
        if (e.Transaction.AssociatedWindows[0].FloatingParent != null)
        {
            e.Transaction.AssociatedWindows[0].FloatingParent.ControlBox = false;
            e.Transaction.AssociatedWindows[0].FloatingParent.FormBorderStyle = FormBorderStyle.FixedSingle;
        }
    }

    Greetings,
    Nikolay
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  5. Daryl
    Daryl avatar
    15 posts
    Member since:
    Jan 2011

    Posted 16 Feb 2011 Link to this post

    I used this as stated and I still see an the close widget 

    BTW this works for a DocumentWindow, but this is a ToolWindow....

     x_DOCK_PALETTE.DocumentButtons &= ~Telerik.WinControls.UI.Docking.DocumentStripButtons.Close;

    Did I type something wrong?
  6. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 17 Feb 2011 Link to this post

    Hello Daryl,

    If I understand correctly, you want to remove buttons from a ToolWindow when it is added to the RadDock. If that's correct, you can set the ToolStripCaptionsButtons. Either through the designer, in load, or when the window is added to the RadDock as below

    private void radDock1_DockWindowAdded(object sender, DockWindowEventArgs e)
    {
        if (radDock1.ActiveWindow is ToolWindow)
        {
            ToolWindow window = (ToolWindow)radDock1.ActiveWindow;
            window.ToolCaptionButtons = ToolStripCaptionButtons.AutoHide & ToolStripCaptionButtons.SystemMenu;
        }
    }

    Hope that helps
    Richard
  7. Daryl
    Daryl avatar
    15 posts
    Member since:
    Jan 2011

    Posted 17 Feb 2011 Link to this post

    Richard - you understood correctly.  My mistake for not seeing the separate "ToolStripCaptionButtons" property.  The code below worked great!  Thanks!

     
    x_DOCK_PALETTE.ToolCaptionButtons = ~ToolStripCaptionButtons.Close; 

     

     

     

     



     

  8. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 17 Feb 2011 Link to this post

    Glad that helped.
    All the best
    Richard
  9. Tino
    Tino avatar
    86 posts
    Member since:
    Jul 2017

    Posted 11 Feb 2018 in reply to Richard Slade Link to this post

    7 years on, but this came up in my search results and didn't work for me.

    I think

    if (radDock1.ActiveWindow is ToolWindow)

    should be

    if (e.DockWindow is ToolWindow)

    otherwise the code applies to the same tool window every time. At least in the latest version.

  10. Hristo
    Admin
    Hristo avatar
    1519 posts

    Posted 12 Feb 2018 Link to this post

    Hello Tino,

    Indeed, you are correct. The dock window can be retrieved from the event arguments. Thank you for updating the thread.

    Let me know if you have other questions.

    Regards,
    Hristo
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top