This is a migrated thread and some comments may be shown as answers.
radpane header mousewheel click ==> close
9 Answers 58 Views
This is a migrated thread and some comments may be shown as answers.
ks
Top achievements
Rank 1
ks asked on 31 Dec 2013, 02:05 PM

Hello

How can I implement the following behaviour?

When a user clicks the header of a radpane with the mouse wheel then the radpane should close.

(same behaviour when you click a tabheader in Internet Explorer)

Thanks!

9 Answers, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 02 Jan 2014, 02:39 PM
Hello Labarque,

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
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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 >>
0
ks
Top achievements
Rank 1
answered on 02 Jan 2014, 08:08 PM

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>
0
Accepted
Kalin
Telerik team
answered on 03 Jan 2014, 09:50 AM
Hello Labarque,

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
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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 >>
0
ks
Top achievements
Rank 1
answered on 03 Jan 2014, 11:27 AM
Super! This works perfectly for me.
Thank you!
0
Victor
Top achievements
Rank 1
answered on 19 Oct 2020, 12:58 PM
Hello. By default, pressing the mouse wheel (on RadPane header) closes the RadPane. How can I disable this option? Example attached.
0
Dinko
Telerik team
answered on 20 Oct 2020, 09:33 AM

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).

0
Victor
Top achievements
Rank 1
answered on 20 Oct 2020, 12:14 PM

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.

0
Martin Ivanov
Telerik team
answered on 23 Oct 2020, 07:35 PM

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/.

0
Victor
Top achievements
Rank 1
answered on 27 Oct 2020, 01:28 PM

Hello Martin,

Thanks for clarification.

Asked by
ks
Top achievements
Rank 1
Answers by
Kalin
Telerik team
ks
Top achievements
Rank 1
Victor
Top achievements
Rank 1
Dinko
Telerik team
Martin Ivanov
Telerik team
Share this question
or