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

Mouse action to change the view

3 Answers 138 Views
FileDialogs
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Patrick asked on 26 Jun 2020, 12:52 PM

Hello,

In the Windows Explorer, you can change the view using Ctrl+Mouse Wheel.

Your file dialogs should do the same.

3 Answers, 1 is accepted

Sort by
0
Accepted
Dinko | Tech Support Engineer
Telerik team
answered on 01 Jul 2020, 12:20 PM

Hi Patrick,

There is a logged a feature request to implement such keyboard navigation in our FileDialogs. I have updated the feedback item to include this one. 

As a workaround: You can achieve this behavior using custom code. You can subscribe to the PreviewMouseWheel event of the control. In the event handler, you can check the current wheel direction and change the selected item of the layout configurator RadComboBox control. The following code snippet demonstrate what I have in mind.

private void SaveFileDialog_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
    if(Keyboard.IsKeyDown(Key.LeftCtrl))
    {
        RadSaveFileDialog radsaveFileDialog = sender as RadSaveFileDialog;
        RadComboBox layOutComboBox = radsaveFileDialog.ChildrenOfType<RadComboBox>().FirstOrDefault(x=>x.Name == "PART_LayoutConfigurator");
        if(e.Delta >0)
        {
            if (layOutComboBox.SelectedIndex != layOutComboBox.Items.Count-1)
            {
                layOutComboBox.SelectedIndex = layOutComboBox.SelectedIndex + 1;
            }
        }
        else
        { 
            if (layOutComboBox.SelectedIndex != 0)
            {
                layOutComboBox.SelectedIndex = layOutComboBox.SelectedIndex - 1;
            }
        }            
        e.Handled = true;
    }
}

Regards,
Dinko
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 07 Jul 2020, 08:48 AM
Hi Dinko,
It works, but I really think that it must work "out-of-the-box", without these kind of patches.
0
Dinko | Tech Support Engineer
Telerik team
answered on 07 Jul 2020, 02:22 PM

Hello Patrick,

You are right that this will be a good improvement to the control. I have already increased its priority so that our developers can consider its implementation.

If you have any other questions, you can open a new thread with your inquiries inside.

Regards,
Dinko
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
commented on 14 Jun 2022, 02:54 PM

Hello Dinko,

I come back to you about this.

Is there a possibility, in your code, to detect that the mouse is over the file lists, in order to change the view only when the mouse cursor is over this part of the dialog?

Regards

Dilyan Traykov
Telerik team
commented on 17 Jun 2022, 11:33 AM

Hello Patrick,

You can add an additional check whether the IsMouseOver property of the FileBrowserTabControl is True and invoke the logic Dinko provided only in this case:

        private void SaveFileDialog_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
        {
            if (Keyboard.IsKeyDown(Key.LeftCtrl))
            {
                RadSaveFileDialog radsaveFileDialog = sender as RadSaveFileDialog;
                RadComboBox layOutComboBox = radsaveFileDialog.ChildrenOfType<RadComboBox>().FirstOrDefault(x => x.Name == "PART_LayoutConfigurator");
                FileBrowserTabControl fileBrowser = radsaveFileDialog.ChildrenOfType<FileBrowserTabControl>().FirstOrDefault();
                if (fileBrowser.IsMouseOver)
                {
                    if (e.Delta > 0)
                    {
                        if (layOutComboBox.SelectedIndex != layOutComboBox.Items.Count - 1)
                        {
                            layOutComboBox.SelectedIndex = layOutComboBox.SelectedIndex + 1;
                        }
                    }
                    else
                    {
                        if (layOutComboBox.SelectedIndex != 0)
                        {
                            layOutComboBox.SelectedIndex = layOutComboBox.SelectedIndex - 1;
                        }
                    }

                    e.Handled = true;
                }
            }
        }

Please let me know if this works for you.

Patrick
Top achievements
Rank 2
Iron
Iron
Iron
commented on 17 Jun 2022, 03:31 PM

Hello Dilyan,

This works when the mouse cursor is over the combo-box with the displays, but in Windows Explorer it works when the mouse cursor is over the llist of files.

Regards

Dilyan Traykov
Telerik team
commented on 22 Jun 2022, 01:26 PM

Hello Patrick,

For your reference, I'm attaching a small sample project where, using the code suggested above, the layout of the dialog is only changed if the mouse wheel is moved over the list of files. You can also find a short recording of the result I observe.

Can you please have a look and let me know if this differs from the behavior you observe at your end with this project?

Patrick
Top achievements
Rank 2
Iron
Iron
Iron
commented on 27 Jun 2022, 05:54 AM

Hi Dilyan.

Thank you for the code: it's working !

Regards

Tags
FileDialogs
Asked by
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or