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