double click on OpenFileDialog is raising ItemClick event on RadTreeview

4 posts, 0 answers
  1. Apar
    Apar avatar
    4 posts
    Member since:
    Jul 2015

    Posted 17 Jul 2015 Link to this post

    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.

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2967 posts

    Posted 21 Jul 2015 Link to this post

    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
  3. Bill
    Bill avatar
    2 posts
    Member since:
    Jun 2013

    Posted 04 Apr in reply to Petar Mladenov Link to this post

    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.

  4. Tanya
    Admin
    Tanya avatar
    518 posts

    Posted 05 Apr Link to this post

    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 allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top