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
245
XamNumericEditor with Integer32 + Spin = System.NullReferenceException
posted

I have a XamNumericEditor  declared as follow :

<igEditors:XamNumericEditor x:Name="_xamNumericEditorNumberOfObjectToAdd" DockPanel.Dock="Left"
                        ValueType="{x:Type sys:Int32}" Value="{Binding NumberOfObjectToAdd}" Mask="99" PromptChar=" " Width="50"
                        DataMode="Raw" DisplayMode="Raw" SpinIncrement="1" SpinWrap="False"  SpinButtonDisplayMode="Always">
                    <igEditors:XamNumericEditor.ValueConstraint>
                        <igEditors:ValueConstraint Nullable="False" ValidateAsType="Integer32"
                                MaxInclusive="50" MinInclusive="1" />
                    </igEditors:XamNumericEditor.ValueConstraint>

</igEditors:XamNumericEditor>

 

And when I click on it, it throws this exception :

System.NullReferenceException: La référence d'objet n'est pas définie à une instance d'un objet.
   à Infragistics.Windows.Editors.SpinInfo.GetResolvedMinMax(Object& min, Object& max, Type& valueType)
   à Infragistics.Windows.Editors.SpinInfo.GetResolvedMinMaxAsDecimal(Object& min, Object& max)
   à Infragistics.Windows.Editors.SpinInfo.IsValueValid(Object value)
   à Infragistics.Windows.Editors.SpinInfo.SpinHelper(Boolean up, Object& newValue)
   à Infragistics.Windows.Editors.SpinInfo.CanSpin(Boolean up)
   à Infragistics.Windows.Editors.EditInfo.CanSpin(Boolean up, Object amount)
   à Infragistics.Windows.Editors.EditInfo.get_CurrentState()
   à Infragistics.Windows.Editors.XamMaskedEditor.Infragistics.Windows.Commands.ICommandHost.GetCurrentState(Int64 statesToQuery)
   à Infragistics.Windows.Commands.CommandUtilities.IsMinimumStatePresent(ICommandHost host, Nullable`1 hostState, RoutedCommand command, Boolean& forceHandled)
   à Infragistics.Windows.Commands.CommandUtilities.IsMinimumStatePresent(ICommandHost host, RoutedCommand command, Boolean& forceHandled)
   à Infragistics.Windows.Commands.Commands`1.IsCommandAllowed(ICommandHost commandHost, RoutedCommand command, Object commandParameter, Object originalSource, Boolean& continueRouting, Boolean& forceHandled)
   à Infragistics.Windows.Commands.Commands`1.OnQueryCommand(Object target, CanExecuteRoutedEventArgs args)
   à System.Windows.Input.CommandBinding.OnCanExecute(Object sender, CanExecuteRoutedEventArgs e)
   à System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
   à System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
   à System.Windows.Input.CommandManager.OnCanExecute(Object sender, CanExecuteRoutedEventArgs e)
   à System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   à System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   à System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   à System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   à System.Windows.Input.RoutedCommand.CanExecuteImpl(Object parameter, IInputElement target, Boolean trusted, Boolean& continueRouting)
   à System.Windows.Input.RoutedCommand.CanExecute(Object parameter, IInputElement target)
   à MS.Internal.Commands.CommandHelpers.CanExecuteCommandSource(ICommandSource commandSource)
   à System.Windows.Controls.Primitives.ButtonBase.HookCommand(ICommand command)
   à System.Windows.Controls.Primitives.ButtonBase.OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   à System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   à System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   à System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   à System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)
   à System.Windows.StyleHelper.ApplyTemplatedParentValue(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, DependencyProperty dp, FrameworkElementFactory templateRoot)
   à System.Windows.StyleHelper.InvalidatePropertiesOnTemplateNode(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, Boolean isDetach, FrameworkElementFactory templateRoot)
   à System.Windows.StyleHelper.LoadOptimizedTemplateContent(DependencyObject container, ParserContext parserContext, OptimizedTemplateContent optimizedTemplateContent, FrameworkTemplate frameworkTemplate, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
   à System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
   à System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
   à System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
   à System.Windows.FrameworkElement.ApplyTemplate()
   à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   à System.Windows.UIElement.Measure(Size availableSize)
   à System.Windows.Controls.DockPanel.MeasureOverride(Size constraint)
   à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   à System.Windows.UIElement.Measure(Size availableSize)
   à System.Windows.ContextLayoutManager.UpdateLayout()
   à System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   à System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   à System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   à System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   à System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)

 

How can I solve it plz ?

PS: How can I add fomatted code on the forum ?