9 Answers, 1 is accepted
The desired scenario can be achieved by handling the MouseDown event of the main Border in the PaneHeaderTemplate. Inside of the handler you can easily get the clicked Pane and hide it. Please check the attached sample project which demonstrates the exact approach.
Hope this helps. If you have any further questions, let us know.
Regards,
Kalin
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Thank you Kalin for the reply.
I do not get this working in the following scenario. Can you help me on this?
Thanks!
<
telerik:RadDocking
x:Name
=
"Docking"
>
<
telerik:RadDocking.DocumentHost
>
<
telerik:RadSplitContainer
>
<
telerik:RadPaneGroup
>
<
telerik:RadPane
Header
=
"Pane 2"
/>
</
telerik:RadPaneGroup
>
</
telerik:RadSplitContainer
>
</
telerik:RadDocking.DocumentHost
>
</
telerik:RadDocking
>
It is not working because the Pane uses different Templates for the different scenarios. In this case you would also need to extract the PaneDocumentHostTemplate and handle the MouseDown event of the Grid inside. However I can also suggest another solution in which you could simply handle the MouseDown event of the Docking and check inside for the clicked element as shown below:
XAML:
<
telerik:RadDocking
x:Name
=
"Docking"
MouseDown
=
"OnMouseDownHandler"
>
<
telerik:RadDocking.DocumentHost
>
<
telerik:RadSplitContainer
>
<
telerik:RadPaneGroup
>
<
telerik:RadPane
Header
=
"Pane 1"
/>
</
telerik:RadPaneGroup
>
</
telerik:RadSplitContainer
>
</
telerik:RadDocking.DocumentHost
>
<
telerik:RadSplitContainer
InitialPosition
=
"DockedRight"
>
<
telerik:RadPaneGroup
>
<
telerik:RadPane
Header
=
"Pane 2"
/>
</
telerik:RadPaneGroup
>
</
telerik:RadSplitContainer
>
</
telerik:RadDocking
>
Code behind:
private
void
OnMouseDownHandler(
object
sender, MouseButtonEventArgs e)
{
if
(e.ChangedButton == MouseButton.Middle && e.ButtonState == MouseButtonState.Pressed)
{
var item = (FrameworkElement)e.OriginalSource;
var pane = item.ParentOfType<RadPane>();
if
(pane !=
null
)
{
(pane
as
RadPane).IsHidden =
true
;
}
else
{
var paneHeader = item.ParentOfType<PaneHeader>();
if
(paneHeader !=
null
)
{
(paneHeader.SelectedPane
as
RadPane).IsHidden =
true
;
}
}
}
}
Hope this works for you.
Regards,
Kalin
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Thank you!
Hello Victor,
Thank you for the provided image.
This behavior should not be enabled unless the CloseTabsOnMouseMiddleButtonDown property of the RadPaneGroup, which holds the RadPanes, is set to true. Can you check for this property and set it to false?
Also, the RadPaneGroup derives from RadTabControl. You can check for an implicit style that sets CloseTabsOnMouseMiddleButtonDown property to true on the RadTabControl.
Regards,
Dinko
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).
Hello Dinko,
Thank you for your quick response.
We are using not the latest version of Telerik. Therefore, it is likely that this property CloseTabsOnMouseMiddleButtonDown is not supported in the version we are using.
As for the second option, it is not clear enough for me how to do it correctly. Please give an example if possible.
Hello Victor,
The CloseTabsOnMouseMiddleButtonDown property is available since the R3 2019 release. As for the second option Dinko mentioned, the idea here was to check if there is any Style object targeting the RadPaneGroup control and having a Setter for the CloseTabsOnMouseMiddleButtonDown property.
If this information doesn't help, I would recommend you to share some code that can be used to assemble a runnable RadDocking setup or to open a private support ticket from your telerik.com account and send a runnable project showing your setup there.
Regards,
Martin Ivanov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hello Martin,
Thanks for clarification.