Double click on grid

6 posts, 0 answers
  1. Stuart
    Stuart avatar
    10 posts
    Member since:
    Feb 2013

    Posted 25 Sep 2013 Link to this post

    Hello,

    I've got double click on a task on the right hand side working, but cannot seem to be able to double click on a row on the grid on the left hand side?

    Any pointers?

    thanks
  2. Rosi
    Admin
    Rosi avatar
    2527 posts

    Posted 25 Sep 2013 Link to this post

    Hi,

    You can double click on a cell of grid row and enter the edit mode of the cell. However to do that you need to add CellEditTemplate to the column definition.

    For more details please review our online demo and our documentation.


    Regards,
    Rosi
    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Stuart
    Stuart avatar
    10 posts
    Member since:
    Feb 2013

    Posted 26 Sep 2013 Link to this post

    Hi,

    I realise my initial question wasn't explicit enough. See the example here: https://github.com/telerik/xaml-sdk/tree/master/GanttView/EventDoubleClick, which works great when you double click on a task on the right hand side. I want to be able to double click on a row on the grid on the left hand side, and do something with the task which was double clicked on, not edit the cell.
  5. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 26 Sep 2013 Link to this post

    Hello,

    If the goal of the double click is to be able to do operations with the selected task you could simply use the MouseDoubleClick of the RadGanttView control and in it add a condition that will check if the SelectedItem of the control is not null. In the RadGanttView control the first click will select the task, and when using the MouseDoubleClick event if you have double clicked on a row the SelectedItem will be set to the task which was double clicked.

    The next code snippet shows the described approach:
    <telerik:RadGanttView ... MouseDoubleClick="RadGanttView_MouseDoubleClick">
        ...
    </telerik:RadGanttView>

    and in the code behind:
    private void RadGanttView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
        var radGanttView = sender as RadGanttView;
     
        if (radGanttView != null)
        {
            var selectedTask = radGanttView.SelectedItem as GanttTask;
            if (selectedTask != null)
            {
                MessageBox.Show(string.Format("DoubleClick on: \n {0}!", selectedTask.Title));
            }
        }
    }

    Hope this is helpful.

    Regards,
    Vladi
    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 >>
  6. Stuart
    Stuart avatar
    10 posts
    Member since:
    Feb 2013

    Posted 26 Sep 2013 Link to this post

    Vladi,

    That is super helpful. I need to send the double click through to a viewmodel in an MVVM scenario, but that's easily done with an attached behaviour.

    Perhaps I'm misunderstanding the point of the double click example in the xaml-sdk up on github?

    Anyway, I feel a bit dumb now, thanks for your help :)
  7. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 26 Sep 2013 Link to this post

    Hello,

    The purpose of the EventDoubleClick example in our SDK repository is to show a way to add a DoubleClick event to the EventContainers (the tasks boxes in the TimeRuler) of the RadGanttView control. That approach could be useful in scenarios where only double clicking on those boxes is desired.

    Regards,
    Vladi
    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 >>
Back to Top
UI for WPF is Visual Studio 2017 Ready