3 Answers, 1 is accepted
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
Our thoughts here at Progress are with those affected by the outbreak.
It works, but I really think that it must work "out-of-the-box", without these kind of patches.
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
Our thoughts here at Progress are with those affected by the outbreak.
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
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.
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
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?
Hi Dilyan.
Thank you for the code: it's working !
Regards