Avoiding RadDiagramShape being deleted

3 posts, 1 answers
  1. Deepak Shakya
    Deepak Shakya avatar
    118 posts
    Member since:
    Aug 2007

    Posted 09 Nov 2012 Link to this post

    Hi,

    The EditTemplate of the Shape has a textbox. When I deleted the data in the textbox and by chance the user presses the delete one more time, the shape get the focus and is deleted. This is nuisance when the Edit template contains more than one textboxes and the rest of the data has been filled.

    How do we avoid the shape being deleted when editing the data? Is there a way so that the focus remains in the textbox even when there is no data?

    The sample (DiagramsMvvmSample) can be downloaded from my skydrive

    Cheers
    Deepak
  2. Answer
    Stefan
    Admin
    Stefan avatar
    89 posts

    Posted 09 Nov 2012 Link to this post

    Hi Deepak,

    Thank you for bringing this issue to our attention. I investigated it and I can confirm that this is a bug, which I logged in our PITS. Also I updated you Telerik's points accordingly.

    Until a fix is provided I can suggest you a workaround - you can handle the KeyDown event for the TextBox in the ShapeEditTemplate and check if the pressed key is Delete and if the TextBox's text is empty. If both conditions are fulfilled you have to handle the event. Here is a snippet ot the code I used for this approach:

    private void TextBox_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.Key.Equals(Key.Delete) && (sender as TextBox).Text == String.Empty)
        {
            e.Handled = true;
        }
    }

    Please give this workaround a try and let us know if it works for you.

    All the best,
    Stefan
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Deepak Shakya
    Deepak Shakya avatar
    118 posts
    Member since:
    Aug 2007

    Posted 09 Nov 2012 Link to this post

    Hi Stefan,

    Thanks for providing the workaround and logging the issue in PITS. I will use the solution until the issue has been resolved.

    Cheers!
Back to Top