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

double click on OpenFileDialog is raising ItemClick event on RadTreeview

3 Answers 414 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Apar
Top achievements
Rank 1
Apar asked on 17 Jul 2015, 01:25 PM

Hi,

I have radtreeview control and when OpenFileDialog is shown on top of that control and an item is selected using double click, the OpenFileDialog gets closed which is the expected behavior as the file has been selected. But also the Itemclick event is fired on the treeviewitem which is exactly behind the point where the double click happened on the filedialog.

 

Can you please let me know how to avoid the ItemClick event.

 Thanks.

3 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 21 Jul 2015, 08:16 AM
Hello Apar,

You have hit a know issue in the WPF framework - mouseup event fires on control behind OpenFileDialog when doubleclicking on a file.
MSDN Forum - Stop Mouse Evtn from Firing..
StackOverflow - Mouse left button up event and openfiledialog

Generally, part of the issue at your side is that our ItemClick event is fired on Mouseup event of the RadTreeView, its not a typical click event to be raised after down + up on a single element. 

There is know elegant solution for this, however, you can unsubscribe from ItemClick event before opening the OpenFileDialog and then subscribe after some interval (for example 500 milliseconds).
You can find sample code below:
DispatcherTimer timer;
 
private void Button_Click(object sender, RoutedEventArgs e)
       {
           OpenFileDialog dialog = new OpenFileDialog();
           this.tree.ItemClick -= this.tree_ItemClick;
           dialog.ShowDialog();
 
           timer = new DispatcherTimer();
           timer.Interval = new TimeSpan(0, 0, 0, 0, 500);
           timer.Tick +=timer_Tick;
       }
 
       void timer_Tick(object sender, EventArgs e)
       {
           this.tree.ItemClick += this.tree_ItemClick;
           timer.Tick -= this.timer_Tick;
       
 
       private void tree_ItemClick(object sender, Telerik.Windows.RadRoutedEventArgs e)
       {
           
       }


Regards,
Petar Mladenov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Bill
Top achievements
Rank 1
answered on 04 Apr 2017, 07:13 PM

I am using the RadBrowseEditor with a DialogType=OpenFileDialog (OFD) in Winforms. This gets displayed overtop of a RadListView control, and when I double click on a file in the OFD then a list view item underneath the OFD gets selected as well.

I am looking for the correct events to perhaps set some Boolean or timer such that I know to ignore the selection changing in the list view control, but between the RadBrowseEditor, the OpenFileDialog window, and the RadListView events, I'm just not seeing how to implement a solution for this problem.

0
Tanya
Telerik team
answered on 05 Apr 2017, 12:26 PM
Hi Bill,

This thread concerns the controls from the UI for WPF suite. Please, post your question in the UI for WinForms forums or submit a support ticket through your account.

Regards,
Tanya
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
TreeView
Asked by
Apar
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Bill
Top achievements
Rank 1
Tanya
Telerik team
Share this question
or