How to disable dragdrop when editing cell

3 posts, 0 answers
  1. Valerie
    Valerie avatar
    36 posts
    Member since:
    Nov 2011

    Posted 26 Mar 2013 Link to this post

    If I am in edit mode and try to select the text with my mouse it thinks I am dragging that row. I tried to disable this with this code but it had no effect.

                    <Style TargetType="telerik:GridViewCell" >
                        <Style.Triggers>
                            <Trigger Property="IsInEditMode" Value="True">
                                <Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="False"></Setter>
                            </Trigger>
                        </Style.Triggers>
                    </Style>

    I then added code to OnDragInitialize in my DragDropBehavior attached behavior that returns if the current cell is in edit mode. It does stop the drag from happening but it also interferes with the user from selecting the string. It stops after the first character and changes the cursor to an arrow.

            private void OnDragInitialize(object sender, DragInitializeEventArgs e)<br>        {<br><div><span style="font-size: 11px; line-height: 1.4;">            var radGridClientObject = sender as RadGridView;</span><br></div>            if (radGridClientObject != null)<br>            {<br>                if (radGridClientObject.CurrentCell.IsInEditMode)<br>                {<br>                    return;<br>                }<br>            }<br><div></div>

    How can I disable drag/drop when in edit mode?
    Thanks, Valerie

  2. Nick
    Admin
    Nick avatar
    593 posts

    Posted 27 Mar 2013 Link to this post

    Hello Valerie,

    I can speculate that you have subscribed for the DragInitialize event with handledEventsToo set to true, considering the behavior you are experiencing. Is that correct? 

    You can stop the Drag operation in the DragInitialize handler by setting the e.Cancel to true. 

    Let me know if that works! 

    Greetings,
    Nik
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Valerie
    Valerie avatar
    36 posts
    Member since:
    Nov 2011

    Posted 27 Mar 2013 Link to this post

    Thanks Nik, that was it! The cancel worked perfectly.
Back to Top