When hitting the "*" key the Property Grid throws an null reference exception

Grids for WPF Forum

Posted 12 years ago by cesar priego
Version: 12.1.0562

I have this problem with the Property Grid that when you hit the "*" key in textbox bound to a "double" type value I get the error {"Object reference not set to an instance of an object."}.

The thing is that I haven't managed to catch the error, and it only happens with the "*" key. Any idea why is this happenning?

Comments (4)

Posted 12 years ago by cesar priego

This is the exception I get


System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Controls.TreeViewItem.ExpandRecursive(TreeViewItem item)
at System.Windows.Controls.TreeView.ExpandSubtree(TreeViewItem container)
at System.Windows.Controls.TreeView.OnKeyDown(KeyEventArgs e)
at ActiproSoftware.Windows.Controls.PropertyGrid.PropertyGrid.OnKeyDown(KeyEventArgs e)
at System.Windows.UIElement.OnKeyDownThunk(Object sender, KeyEventArgs e)
at System.Windows.Input.KeyEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Cesar,

I'm not sure what is causing that since it's all internal to Microsoft's code.  Our PropertyGrid.OnKeyDown method just prevents the Tab key from being handled.  Then we call the base TreeView.OnKeyDown method.  Are you able to reproduce it in one of our samples for the latest version?  I was unable to make it occur.

Actipro Software Support

Posted 12 years ago by cesar priego

Hi, thanks for your answer.

Try to use the property grid of the on line sample you provide here http://www.actiprosoftware.com/files/demos/online/wpf/samplebrowser.xbap (Themes quickstart), try to type and "*" in any of the editboxes of that property grid and you will see the message "An error occurred in the application you were using"


Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Cesar,

Thanks, we could repro it.  Since it's deep in Microsoft's code, I'm not sure what is causing it.  However you can override PropertyGrid.OnKeyDown and if the Key.Multiply is pressed, then mark it as e.Handled.  That will prevent the issue, and we've updated our code for the 2012.2 version to do that same.

Actipro Software Support

The latest build of this product (v24.1.2) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.