How do I remove the close button from a RadDock documentwindow

8 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
    1735 posts
    Member since:
    Dec 2014

    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
    1735 posts
    Member since:
    Dec 2014

    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

Back to Top