Thanks,
G
11 Answers, 1 is accepted
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
Thanks a bunch for taking the time to help me out.
G
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
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
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,
G
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
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
Everything now works exactly as I envisioned.
Thanks,
G
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
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
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