Completed
Last Updated: 20 Oct 2014 14:29 by ADMIN
ADMIN
George
Created on: 01 Sep 2014 10:56
Category: Dock
Type: Bug Report
1
FIX. RadDock - the close button is not visible, when reopening a window, which ShowItemCloseButton property was set after the ToolTabStrip of RadDock had windows
To reproduce:

Use the following methods which adds host windows to ToolTabStrip and set the ShowItemCloseButton:

private void AddDocumentStrip()
{
    // Create and add a document strip to the dock.
    this.documentstrip = new ToolTabStrip();
    this.documentstrip.TabStripAlignment = TabStripAlignment.Top;
    this.documentstrip.CaptionVisible = false;
    this.documentstrip.ActionMenuButton.Visibility = ElementVisibility.Hidden;
    this.DocumentDock.Controls.Add(documentstrip);
    this.DocumentDock.ShowToolCloseButton = true;
}

private void radCommandBar1_Click(object sender, EventArgs e)
{
    RadForm testdoc = new RadForm();

    // Create a hostwindow to hold the document (so can interact with the dock)
    HostWindow hostwindow = new HostWindow();
    hostwindow.Text = "Document " + DocumentDock.DockWindows.Count.ToString();
    hostwindow.ToolCaptionButtons = ToolStripCaptionButtons.Close;

    // Load the document into the host window
    hostwindow.LoadContent(testdoc);

    // Set the floating size when it is undocked
    Size size = new Size(660, 440);
    hostwindow.DefaultFloatingSize = size;

    // Make sure a closed document releases its resources
    hostwindow.CloseAction = DockWindowCloseAction.CloseAndDispose;

    // Check if we are opening our first document, requires additional setup
    //if (currentdocuments.Count == 0)
    if (DocumentDock.ActiveWindow == null)
    {
        if (this.DocumentDock.Controls.Count < 2)
        {
            this.documentstrip.Controls.Add(hostwindow);
            this.documentstrip.CaptionVisible = true;
            this.DocumentDock.Controls.Add(documentstrip);
            this.DocumentDock.ShowToolCloseButton = true;
        }
        else
        {
            ((ToolTabStrip)this.DocumentDock.Controls[1]).Controls.Add(hostwindow);
            ((ToolTabStrip)this.DocumentDock.Controls[1]).CaptionVisible = true;
            this.DocumentDock.ShowToolCloseButton = true;
        }
    }
    else
    {
        documentstrip.Controls.Add(hostwindow);
        documentstrip.Show();
    }
    this.documentstrip.Text = "Document " + DocumentDock.DockWindows.Count.ToString();

    //Bring Analyzer to the front
    this.Activate();
}


Click the button a few times, close all windows and click again. You will notice that the close button will not be visible in the new windows.

Alternatively, you can download the sample project.

Workaround:

Manually set the ShowItemCloseButton property to each child ToolTabStrip:

private void AddDocumentStrip()
{
    // Create and add a document strip to the dock.
    this.documentstrip = new ToolTabStrip();
    this.documentstrip.TabStripAlignment = TabStripAlignment.Top;
    this.documentstrip.CaptionVisible = false;
    this.documentstrip.ActionMenuButton.Visibility = ElementVisibility.Hidden;
    this.DocumentDock.Controls.Add(documentstrip);
    this.DocumentDock.ShowToolCloseButton = true;
}

private void radCommandBar1_Click(object sender, EventArgs e)
{
    RadForm testdoc = new RadForm();

    // Create a hostwindow to hold the document (so can interact with the dock)
    HostWindow hostwindow = new HostWindow();
    hostwindow.Text = "Document " + DocumentDock.DockWindows.Count.ToString();
    hostwindow.ToolCaptionButtons = ToolStripCaptionButtons.Close;

    // Load the document into the host window
    hostwindow.LoadContent(testdoc);

    // Set the floating size when it is undocked
    Size size = new Size(660, 440);
    hostwindow.DefaultFloatingSize = size;

    // Make sure a closed document releases its resources
    hostwindow.CloseAction = DockWindowCloseAction.CloseAndDispose;

    // Check if we are opening our first document, requires additional setup
    //if (currentdocuments.Count == 0)
    if (DocumentDock.ActiveWindow == null)
    {
        if (this.DocumentDock.Controls.Count < 2)
        {
            this.documentstrip.Controls.Add(hostwindow);
            this.documentstrip.CaptionVisible = true;
            this.DocumentDock.Controls.Add(documentstrip);
            this.DocumentDock.ShowToolCloseButton = true;
        }
        else
        {
            ((ToolTabStrip)this.DocumentDock.Controls[1]).Controls.Add(hostwindow);
            ((ToolTabStrip)this.DocumentDock.Controls[1]).CaptionVisible = true;
            foreach (ToolTabStrip strip in this.DocumentDock.EnumFrameworkControls<ToolTabStrip>())
            {
                strip.ShowItemCloseButton = true;
            }
        }
    }
    else
    {
        documentstrip.Controls.Add(hostwindow);
        documentstrip.Show();
    }
    this.documentstrip.Text = "Document " + DocumentDock.DockWindows.Count.ToString();

    //Bring Analyzer to the front
    this.Activate();
}
Attached Files:
0 comments