Select full row issues

7 posts, 1 answers
  1. dani
    dani avatar
    48 posts
    Member since:
    Jan 2011

    Posted 05 Feb 2013 Link to this post

    Hi,
    (Wrongly posted on gant forum)

    I want to create this behavior:

    I want to be able to select only full lines, and act on double click on the line -

    currently I have 2 problems with this code:

    <telerik:RadGridView Name="gdTestRecords" DockPanel.Dock="Bottom" AutoGenerateColumns="False" ClipboardCopyMode ="All" MouseDoubleClick="gdTestRecords_MouseDoubleClick" SelectionMode="Extended" SelectionUnit="FullRow" MaxHeight="600" ScrollViewer.VerticalScrollBarVisibility="Visible">


    1, when I double click inside the line - it selects the cell and not the line - I can only choose the line by clicking on the edge of the line.
        this code will return null: RecordType st = ((FrameworkElement)e.OriginalSource).DataContext as RecordType (unless I click on the edge)
    2. when I click on the vertical scroll bar more than 2 times - it acts like selecting a cell ! - I need to interpreting clicking on scroll bar as clicking on the grid surface and not clicking inside the line.

    How can I fix this ?

  2. Nick
    Admin
    Nick avatar
    593 posts

    Posted 06 Feb 2013 Link to this post

    Hello Dani,

    I am not sure I understand correctly your first problem. What exactly do you mean by it selects the cell and not the line ? Maybe a screenshot could better illustrate what is your exact problem.

    As to the second issue, the DoubleClickEvent is fired because the subscription is for the GridView and respectively all of its child elements. You have to check if the Source of the event is valid for execution of your custom logic in order to achieve a correct scenario.

    Hope this helps! Looking forward to hearing from you! 

    Kind regards,
    Nik
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. dani
    dani avatar
    48 posts
    Member since:
    Jan 2011

    Posted 06 Feb 2013 Link to this post


    When I check what I get back from double clicking;

    RecordType st = ((FrameworkElement)e.OriginalSource).DataContext as RecordType

    I get null when clicking inside the grid and I get the row object only when clicking on the side arrow of a grid line.
    I want that wherever the user clicks inside the gtid row to get yhe full row object and not the cell.

    Dani
  4. Nick
    Admin
    Nick avatar
    593 posts

    Posted 06 Feb 2013 Link to this post

    Hello Dani,

    Great. The issue here is that the double click event is fired to late. Meaning the row has already gotten in edit mode, and you get the event with source the cell in edit mode. 
    To workaround the issue, you have to use the PreviewMouseDoubleClick event, or use the approach shown in this example.

    Hope this helps! 

    Greetings,
    Nik
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. dani
    dani avatar
    48 posts
    Member since:
    Jan 2011

    Posted 07 Feb 2013 Link to this post

    This is a silverlite example.
    Is it the same as WPF ?
    I didn't see any PreviewMouseDoubleClick handling there. it selects the cell.....
    I need to get the row object wherever I click anywhere inside the row, and filter click events on the scroll bar.
    I think these are 2 issues here.
    (the PreviewMouseDoubleClick will help filter the scroll bar I guess, don't know how yet...)
    and how can I get the row object once clicking on a cell inside ?

    Thanks,
    Dani

  6. Answer
    Nick
    Admin
    Nick avatar
    593 posts

    Posted 12 Feb 2013 Link to this post

    Hello Dani,

    I am attaching an example of how you can achieve the behavior.

    Hope it helps! 

    All the best,
    Nik
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  7. dani
    dani avatar
    48 posts
    Member since:
    Jan 2011

    Posted 12 Feb 2013 Link to this post

    Thanks,
    That's what I've needed, I've tried before but I wasn't aware that ParentOfType is telerik function
    Anyway  - it still enters edit mode after returning from my double click but I'll find how to fix this.
    Dani.
Back to Top