Page view counter
Value does not fall within the expected range in Popup Subscribe to this thread
Last post 01-14-2009 1:07 AM by neal.gabriel. 9 replies.
Sort Posts:
01-06-2009 10:40 AM
Value does not fall within the expected range in Popup

Hi All,

I am getting an Unhandled Exception when I try to move / close a popup [I am not sure whether the exception occurs in popup, since it is an application unhandled exception].

The scenario is as follows,

I have a popup which has a Textbox in it

<Popup x:Name="popComments">

<Canvas x:Name="canCommentsPop" Height="80" Width="220" Canvas.ZIndex="4">

<Border BorderBrush="Black" BorderThickness="2" CornerRadius="4">

<TextBox x:Name="txtNotesView" ScrollViewer.VerticalScrollBarVisibility="Auto" Width="220" Height="80" IsReadOnly="True" BorderThickness="0" MouseLeave="txtNotesView_MouseLeave"/>

</Border>

</Canvas>

</Popup>

The Code behind for Mouse Leave is as follows

private void txtNotesView_MouseLeave(object sender, MouseEventArgs e)

{

try

{

if (dtN != null)

{

dtN.Stop();

dtN =
null;

}

dtN =
new System.Windows.Threading.DispatcherTimer();

dtN.Interval = new TimeSpan(0, 0, 0, 1, 0);

dtN.Tick += new EventHandler(dtN_Tick);

dtN.Start();

}

catch

{

}

}

---------------------------------------------------------------------------------

void dtN_Tick(object sender, EventArgs e)

{

try

{

if (popComments.IsOpen)

Dispatcher.BeginInvoke(delegate() { popComments.IsOpen = false; });

if (dtN != null)

{

dtN.Stop();

dtN =
null;

}

}

catch

{

}

}

The popup is opened when a Listbox Item [in DataTemplate] is clicked (<Border Width="180" Cursor="hand" MouseLeftButtonDown="Border_MouseLeftButtonUp">) ;

The Poblem occurs when i move the mouse after activating the popup!

The Exception is as follows

e.ExceptionObject
{System.ArgumentException: 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)}
    [System.ArgumentException]: {System.ArgumentException: 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)}
    Data: {System.Collections.ListDictionaryInternal}
    InnerException: null
    Message: "Value does not fall within the expected range."
    StackTrace: "   at MS.Internal.XcpImports.CheckHResult(UInt32 hr)\r\n   at MS.Internal.XcpImports.Control_Raise(Control control, INativeCoreTypeWrapper arguments, Byte nDelegate)\r\n   at System.Windows.Controls.Control.NativeMouseMove(MouseEventArgs e)\r\n   at System.Windows.Controls.TextBox.OnMouseMove(MouseEventArgs e)\r\n   at System.Windows.Controls.Control.OnMouseMove(Control ctrl, EventArgs e)\r\n   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)"

What could be the possible reason for this! 

Please help me solving this.

Thanks

Neal Gabriel


Regards...

Neal Gabriel

neal.gabriel

Loading...
Joined on 07-18-2008
Cochin, India
Posts 72
01-06-2009 11:10 AM
Re: Value does not fall within the expected range in Popup

Do you have a MouseMove event attached to anything in your page? It seems like this is the source of the issue but I don't see that in any of the code you posted.

-- bryant

Blog | Twitter
_________________
Dont forget to click "Mark as Answer" on the post that helped you.

bryant

Loading...
Joined on 10-23-2002
Simi Valley, CA
Posts 1,153
01-08-2009 4:51 AM
Re: Re: Value does not fall within the expected range in Popup

Hi, Sorry for the late reply!
The only MouseMove event is with the VSM, which is for the Listbox, But Even after removing that, it shows the error!


Regards...

Neal Gabriel

neal.gabriel

Loading...
Joined on 07-18-2008
Cochin, India
Posts 72
01-12-2009 1:12 AM
Re: Re: Value does not fall within the expected range in Popup

 

I am still not able to find a solution to this, I think I missing something with popComments.IsOpen, Just because, When I Commented this in the Code Behind, It Is not showing any error, I tried placing an if condition bfore this, But nothin happened - Still Shows the Same error.. 

I have no Idea in finding a solution to this, If it seems there is no solution, please let me know an alternate solution, that colud work without a popup.

Thanks....


Regards...

Neal Gabriel

neal.gabriel

Loading...
Joined on 07-18-2008
Cochin, India
Posts 72
01-12-2009 3:47 AM
Re: Value does not fall within the expected range in Popup

 Hi Neal,

You can try to check this link to find the cause of the problem.

Or you can try to post a simpler sample application here, so we can use them to reproduce your problem on our local, which will be able helpful further.

 


Amanda Wang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Amanda Wang - MSFT

Loading...
Joined on 04-30-2007
Posts 1,015
01-12-2009 4:50 AM
Re: Value does not fall within the expected range in Popup

 

Hi Amanda,

Thank you very much for the reply.

The Link which you have mentioned is not working, Any way I m attaching a sample program, which has a similar problem

Here is the link

http://cid-fd21c739fb2150e8.skydrive.live.com/self.aspx/Public/TestPopup.rar

If you want me to upload it somewhere else, let me know..

Thanks


Regards...

Neal Gabriel

neal.gabriel

Loading...
Joined on 07-18-2008
Cochin, India
Posts 72
01-12-2009 9:52 PM
Re: Value does not fall within the expected range in Popup

 Hi Neal,

Thanks for your sample project.

But when we run it on our labs, it works fine without any exception.

Could you please tell us how to reproduce your problem with your sample project?

 

Amanda Wang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Amanda Wang - MSFT

Loading...
Joined on 04-30-2007
Posts 1,015
01-12-2009 11:54 PM
Re: Value does not fall within the expected range in Popup

Hi Amanda,

Sorry about I missed the scenario where I used to get the Error.

Click the Subject [Last Column] in the ListBox, You will see the popup which has a TextBox!

Try selecting the Text in the Textbox,

Hold the Mouse LeftButton and when you move outside the Popup [To the ListBox], it errors...

[The Popup is in Open State thou I have written a popup.IsOpen = false in the mousemove of the TextBox in the popup] -


Regards...

Neal Gabriel

neal.gabriel

Loading...
Joined on 07-18-2008
Cochin, India
Posts 72
01-13-2009 11:47 AM
Marked as Answer
Re: Value does not fall within the expected range in Popup

The product team has been made aware of this issue.

 

A couple of workarounds that seem to work for me are changing either the popup’s child’s visibility to collapsed or changing the popup’s child’s opacity to 0, rather than closing the popup.

 

Please let me know if this doesn;t work for you and thanks for reporting the issue!

 

-Andre-

 

remember - please mark answered posts as such

Andre Michaud

Loading...
Joined on 05-25-2007
Redmond, WA
Posts 26
01-14-2009 1:07 AM
Re: Value does not fall within the expected range in Popup

Hi Andre,

It worked..

Thanks a lot..

Neal Gabriel


Regards...

Neal Gabriel

neal.gabriel

Loading...
Joined on 07-18-2008
Cochin, India
Posts 72
Microsoft Communities