This is a migrated thread and some comments may be shown as answers.

Hiding ToolWindow toolbar?

11 Answers 395 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Glenn
Top achievements
Rank 1
Glenn asked on 21 Nov 2012, 06:12 AM
I have set my Docking.ToolWindow.Text to nothing and the ToolCaptionButtons to None. How can I hide the toolbar altogether? Ideally I would like to be able to programmatically make it reappear on mouse over. Is there a property for this somewhere?

Thanks,

G

11 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 21 Nov 2012, 03:26 PM
Hi Glenn,

You need to set the CaptionVisible property of the desired ToolTabStrip to false as described in this article:

this.toolTabStrip1.CaptionVisible = false;

However, I am not sure which part of RadDock you would then like to hover in order to make the caption appear again as the caption would not be available for hover operations at that time. In addition, when you place controls in the ToolWindow, they will start receiving the MouseOver event, so no such events will be processed to the underlying RadDock windows. Let me know if I have misunderstood your requirement, so that I can provide you with an adequate response.

Greetings,
Nikolay
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
0
Glenn
Top achievements
Rank 1
answered on 21 Nov 2012, 03:43 PM
Thanks. This works great. For my purposes, the ToolWindow MouseEnter and MouseLeave work well for handling visibility of the caption. There is a little bit of a trick to detecting if the leave is to move to the caption bar and not hide then, but not so bad.

Thanks a bunch for taking the time to help me out.

G
0
Glenn
Top achievements
Rank 1
answered on 26 Nov 2012, 10:52 PM
Nikolay,

Interestingly, this.toolTabStrip1.CaptionVisible = false does not seem to work once the toolwindow has been undocked and redocked again. Is this a bug or a feature?

Thanks,

G
0
Nikolay
Telerik team
answered on 27 Nov 2012, 11:56 AM
Hello Glenn,

No, this is not an issue in RadDock. RadDock dynamically creates ToolTabStrips to host the ToolWindows that you are dragging. Since the ToolTabStrip instance that you get after redocking the window is new, it is not aware of the CaptionVIsible setting. Therefore, you need to handle the DockTabStripNeeded event, which is fired when RadDock needs to create a ToolTabStrip, and set the property for the newly created strip as well like so:

void radDock1_DockTabStripNeeded(object sender, Telerik.WinControls.UI.Docking.DockTabStripNeededEventArgs e)
{
    ToolTabStrip strip = new ToolTabStrip();
    strip.CaptionVisible = false;
    e.Strip = strip;
}

I hope this helps. Greetings,
Nikolay
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
0
Glenn
Top achievements
Rank 1
answered on 28 Nov 2012, 05:47 AM
I've tried out your example with mixed results. Perhaps I should explain a little better.

I have derived my own class from ToolTabStrip. It has an MouseEnter event that shows the caption bar and a MouseLeave event that hides it.

As suggested, I  created the following code:

private void _uxRadDock_DockTabStripNeeded(object sender, DockTabStripNeededEventArgs e)
        {

            MyToolTabStrip strip = new MyToolTabStrip();
            strip.CaptionVisible = true;
            e.Strip = strip;
        }

This does hide the caption as desired when the MouseLeave event fires and sets the CaptionVisible=false. But now when the MouseEnter event fires and sets CaptionVisible=true nothing happens. The captions is permanently set to not show. There is still something broken. Now instead of not showing the caption, it hides the caption once I leave (as it should) but doesn't show it again on enter (as it should).

Thanks,

0
Nikolay
Telerik team
answered on 28 Nov 2012, 11:41 AM
Hello Glenn,

I was not able to reproduce the described behavior. Please find attached a sample project which follows your scenario. As you can see there, the caption is set to visible and then hidden as expected. If your case is different, please open a new support ticket and send a sample project where that will demonstrate your whole scenario. This will allow me to provide you with a more adequate response.

Kind regards,
Nikolay
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
0
Glenn
Top achievements
Rank 1
answered on 29 Nov 2012, 11:33 PM
I think I understand what is happening now. The difference between your sample and my code is that I'm subscribing the derived ToolTabStrip to the MouseEnter event of the ToolWindow. That way, when the mouse enters the ToolWindow the caption bar will appear. I'm showing video in the ToolWindow and want all the realistate possible, but when the mouse enters I want to show the user that they can undock.

Anyhow, when I redock the same ToolWindow is kept so it is firing to the event handler on the old TabStrip....which is not being garbage collected because of the event that has not been unsubscribed. 

So, what I really need to do is unsubscribe the old TabStrip from the ToolWindow.OnMouseEnter event and subscribe the new TabStrip to it. 

Once DockTabStripNeeded is called, is it possible for me to get a reference to the proper ToolWindow so I can subscribe to this event? And is it possible to get a reference to the old TabStrip to unsubscribe it? Or can I possibly tell it to use the old TabStrip, since it's obviously still around trying to handle events as is evidenced by my debugger?

Part of the challenge is that when the DockTabStripNeeded event fires, I don't know what TabStrip it is firing for, otherwise I could just create my own structure for referencing these objects and wire up and dispose of them as needed. 

Is there anything obvious I'm missing?

Thanks,

G
0
Glenn
Top achievements
Rank 1
answered on 30 Nov 2012, 03:26 PM
I ended up finding a simple solution in the ToolTabStrip.ControlAdded event. From here I can detect if the control being added is a ToolWindow, then unwire the event subscription from this object to the old ToolTabStrip, then wire up the new event handler.

Everything now works exactly as I envisioned.

Thanks,

G
0
Nikolay
Telerik team
answered on 30 Nov 2012, 05:21 PM
Hello Glenn,

I am glad that everything is working as expected for you now. Just as a tip, another approach that you can follow is to unsubscribe from the events in the body of the ToolTabStrip descendant itself in the overridden Dispose method:

public class MyToolTabStrip : ToolTabStrip
{
    public MyToolTabStrip()
    {
        WireEvents();
    }
 
    void MyToolTabStrip_MouseLeave(object sender, EventArgs e)
    {
        this.CaptionVisible = false;
    }
 
    void MyToolTabStrip_MouseEnter(object sender, EventArgs e)
    {
        this.CaptionVisible = true;
    }
 
    void WireEvents()
    {
        this.MouseEnter += new EventHandler(MyToolTabStrip_MouseEnter);
        this.MouseLeave += new EventHandler(MyToolTabStrip_MouseLeave);
    }
 
    void UnwireEvents()
    {
        this.MouseEnter += new EventHandler(MyToolTabStrip_MouseEnter);
        this.MouseLeave += new EventHandler(MyToolTabStrip_MouseLeave);
    }
 
    protected override void Dispose(bool disposing)
    {
        UnwireEvents();
        base.Dispose(disposing);
    }
}

I hope this helps.

All the best,
Nikolay
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
0
Peter
Top achievements
Rank 1
answered on 13 Aug 2016, 12:07 PM

Hi Nikolay,

Is it possible to hide the icon when I drag the ToolWindow control from docking?(when it becomes a Form,there will be a default icon shown)

Regards

Peter

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 15 Aug 2016, 01:42 PM
Hello Peter,

Thank you for writing. 

In order to hide the icon of the floating form, it is necessary to handle the RadDock.FloatingWindowCreated event and set the FloatingWindowEventArgs.Window.ShowIcon property to false:
private void radDock1_FloatingWindowCreated(object sender, Telerik.WinControls.UI.Docking.FloatingWindowEventArgs e)
{
    e.Window.ShowIcon = false;
}

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Tags
Dock
Asked by
Glenn
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Glenn
Top achievements
Rank 1
Peter
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or