Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
355
Critical error in xamwebgrid
posted

The scenario:

We have a xamwebgrid with several template columns. Most of the template columns have text boxes in them, in both the item and edit templates.

When clicking between the columns, all seems well most of the time. However, it looks as if I inadvertently perform a drag of some kind while switching columns with the mouse, I get the following error:

Value does not fall within the expected range.

   at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
   at MS.Internal.XcpImports.Control_Raise(Control control, INativeCoreTypeWrapper arguments, Byte nDelegate)
   at System.Windows.Controls.Control.NativeMouseMove(MouseEventArgs e)
   at System.Windows.Controls.TextBox.OnMouseMove(MouseEventArgs e)
   at System.Windows.Controls.Control.OnMouseMove(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

There are no data or validation issues here, this seems to be totally a "behind the scenes" problem for us.

I have no idea how to even troubleshoot this problem, and putting together a repro sample may be challenging.

Any ideas?

-Chuck

Parents
No Data
Reply
  • 40030
    Verified Answer
    Offline posted

    Hey Chuck, 

    Ok, that was a tough one to narrow down, but I figured out what the problem is and the fixed the issue, so it'll be in the next Service Release.

    So, whats happening is this.  DoubleClick on your TextBox to enter edit mode, the trick is not to let the mouse button up.  Now, while the mouse button is still down, move the mouse...Boom, exception. 

    The stacktrace shows that something is happening with the TextBox's MouseMove event. At first i thought it was the editor textbox that was throwing th exception, however, it's actually the display textbox.  MS is capturing the mouse when a mouse down occurs in the textbox, and listens  to mouse move, until mouse up. However, we're entering edit mode in between there and removing the textbox from the visual tree. Since they have the mouse captured, the events still fire on that textbox, and the exception occurs. 

    So, until the ServiceRelease, you have a couple of options.  

    1. Don't use a TextBox as your display element, especially since you're allowing an edit mode option.  Instead use a TextBlock. 

    2. Change your EditMode actions from double click to single click. 

    Hope this helps, 

    -SteveZ

Children