Wpf 单击xamGrid内的菜单工具时出错

Wpf 单击xamGrid内的菜单工具时出错,wpf,menu,infragistics,Wpf,Menu,Infragistics,我在XamGrid中有一个未绑定的列,其中包含以下样式。单击菜单工具时,出现以下错误。我做错了什么?我使用的是infragistics版本2014和.Net framework 4.0 这是在升级较新版本的基础设施之后发生的 <Style x:Key="GoItemCellControlStyle" TargetType="{x:Type ig:CellControl}" BasedOn="{StaticResource {x:Type ig:CellControl}}">

我在XamGrid中有一个未绑定的列,其中包含以下样式。单击菜单工具时,出现以下错误。我做错了什么?我使用的是infragistics版本2014和.Net framework 4.0 这是在升级较新版本的基础设施之后发生的

 <Style x:Key="GoItemCellControlStyle" TargetType="{x:Type ig:CellControl}" BasedOn="{StaticResource {x:Type ig:CellControl}}">
    <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate>
    <Grid>
    <igRibbon:MenuTool x:Name="ItemMenu" SmallImage="{StaticResource Go16}"  

    ItemsSource="{Binding DataContext.ShellContext.SKULGoCommands,RelativeSource={RelativeSource AncestorType={x:Type ig:XamGrid}}}">
    <igRibbon:MenuTool.Resources>
    <Style TargetType="{x:Type igRibbon:MenuToolPresenter}">
    <Setter Property="Visibility" Value="{Binding IsMouseOver, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type igPrim:CellsPanel}}, Converter={StaticResource VisibilityHiddenIfFalse}}"/>

    </Style>
    </igRibbon:MenuTool.Resources>
    </igRibbon:MenuTool>
    </Grid>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>


System.NullReferenceException
Object reference not set to an instance of an object.
   at System.Windows.Controls.Primitives.Popup.OnWindowResize(Object sender, AutoResizedEventArgs e)
   at System.Windows.Interop.HwndSource.Resize(Size newSize)
   at System.Windows.Interop.HwndSource.OnLayoutUpdated(Object obj, EventArgs args)
   at System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   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)
System.InvalidOperationException
'Toll.ICS.UI.Commands.SKULCommand`2[Toll.ICS.UI.SKUL.Simulation,Toll.ICS.ViewModel.DataContexts.SKUL.SimulationContext]' is not a Visual or Visual3D.
   at MS.Internal.Media.VisualTreeUtils.AsVisual(DependencyObject element, Visual& visual, Visual3D& visual3D)
   at MS.Internal.Media.VisualTreeUtils.AsNonNullVisual(DependencyObject element, Visual& visual, Visual3D& visual3D)
   at System.Windows.Media.VisualTreeHelper.GetParent(DependencyObject reference)
   at Infragistics.Windows.Ribbon.RibbonToolHelper.CoerceSizingMode(DependencyObject d, Object newValue)
   at System.Windows.DependencyObject.ProcessCoerceValue(DependencyProperty dp, PropertyMetadata metadata, EntryIndex& entryIndex, Int32& targetIndex, EffectiveValueEntry& newEntry, EffectiveValueEntry& oldEntry, Object& oldValue, Object baseValue, Object controlValue, CoerceValueCallback coerceValueCallback, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, Boolean skipBaseValueChecks)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.CoerceValue(DependencyProperty dp)
   at Infragistics.Windows.Ribbon.XamRibbon.OnLocationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetValue(DependencyPropertyKey key, Object value)
   at Infragistics.Windows.Ribbon.MenuToolBase.SetLocation(DependencyObject element, Object item)
   at Infragistics.Windows.Ribbon.MenuToolBase.PrepareContainerForItemOverride(DependencyObject element, Object item)
   at Infragistics.Windows.Ribbon.MenuToolBase.PrepareContainerForItemInternal(ToolMenuItem parentMenuItem, DependencyObject element, Object item)
   at Infragistics.Windows.Ribbon.ToolMenuItem.PrepareContainerForItemOverride(DependencyObject element, Object item)
   at System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item)
   at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)
   at System.Windows.Controls.Panel.GenerateChildren()
   at System.Windows.Controls.Panel.EnsureGenerator()
   at System.Windows.Controls.Panel.get_InternalChildren()
   at Infragistics.Windows.Ribbon.Internal.MenuToolPanel.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Decorator.MeasureOverride(Size constraint)
   at Infragistics.Windows.Controls.PopupResizerDecorator.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Decorator.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Decorator.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Primitives.PopupRoot.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Interop.HwndSource.SetLayoutSize()
   at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
   at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
   at System.Windows.Controls.Primitives.Popup.SetRootVisualToPopupRoot()
   at System.Windows.Controls.Primitives.Popup.CreateWindow(Boolean asyncCall)
   at System.Windows.Controls.Primitives.Popup.OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
   at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
   at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
   at System.Windows.Data.BindingExpression.ScheduleTransfer(Boolean isASubPropertyChange)
   at MS.Internal.Data.ClrBindingWorker.NewValueAvailable(Boolean dependencySourcesChanged, Boolean initialValue, Boolean isASubPropertyChange)
   at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
   at MS.Internal.Data.PropertyPathWorker.OnDependencyPropertyChanged(DependencyObject d, DependencyProperty dp, Boolean isASubPropertyChange)
   at MS.Internal.Data.ClrBindingWorker.OnSourceInvalidation(DependencyObject d, DependencyProperty dp, Boolean isASubPropertyChange)
   at System.Windows.Data.BindingExpression.HandlePropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
   at System.Windows.Data.BindingExpressionBase.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
   at System.Windows.Data.BindingExpression.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
   at System.Windows.DependentList.InvalidateDependents(DependencyObject source, DependencyPropertyChangedEventArgs sourceArgs)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at MS.Internal.Data.PropertyPathWorker.SetValue(Object item, Object value)
   at MS.Internal.Data.ClrBindingWorker.UpdateValue(Object value)
   at System.Windows.Data.BindingExpression.UpdateSource(Object value)

System.NullReferenceException
对象引用未设置为对象的实例。
位于System.Windows.Controls.Primitives.Popup.OnWindowResize(对象发送器,AutoResizedEventArgs e)
位于System.Windows.Interop.HwndSource.Resize(大小新闻大小)
位于System.Windows.Interop.HwndSource.OnLayoutUpdated(对象对象obj、事件args args)
位于System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()处
位于System.Windows.ContextLayoutManager.UpdateLayout()处
位于System.Windows.ContextLayoutManager.UpdateLayoutCallback(对象参数)
位于System.Windows.Media.MediaContext.InvokeRenderCallback.DoWork()处
在System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()中
位于System.Windows.Media.MediaContext.RenderMessageHandlerCore(对象大小调整的CompositionTarget)
位于System.Windows.Media.MediaContext.RenderMessageHandler(对象大小调整的CompositionTarget)
位于System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托回调、对象参数、Int32 numArgs)
位于MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(对象源、委托方法、对象参数、Int32 numArgs、委托catchHandler)
System.InvalidOperationException异常
'Toll.ICS.UI.Commands.SKULCommand'2[Toll.ICS.UI.SKUL.Simulation,Toll.ICS.ViewModel.DataContexts.SKUL.SimulationContext]”不是可视化或可视化3D。
在MS.Internal.Media.visualtreutils.AsVisual(DependencyObject元素、Visual3D和Visual3D)
在MS.Internal.Media.visualtreutils.AsNonNullVisual(DependencyObject元素、Visual3D和Visual3D)
位于System.Windows.Media.VisualTreeHelper.GetParent(DependencyObject引用)
在Infragistics.Windows.Ribbon.RibbonToolHelper.impressioningMode(DependencyObject d,Object newValue)中
位于System.Windows.DependencyObject.ProcessImpresseValue(DependencyProperty dp、PropertyMetadata、EntryIndex和EntryIndex、Int32和targetIndex、EffectiveValueEntry和newEntry、EffectiveValueEntry和oldEntry、Object和oldValue、Object baseValue、Object controlValue、强制ValueCallback强制ValueCallback、布尔强制WithDeferredReference、布尔强制WithCurrentValue、布尔skipBaseValueChecks)
在System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex EntryIndex,DependencyProperty dp,PropertyMetadata,EffectiveValueEntry oldEntry,EffectiveValueEntry&newEntry,布尔强制WithDeferredReference,布尔强制WithCurrentValue,OperationType OperationType)
位于System.Windows.DependencyObject.ImpresseValue(DependencyProperty dp)
在Infragistics.Windows.Ribbon.XamRibbon.OnLocationChanged(DependencyObject d,DependencyPropertyChangedEventArgs e)
位于System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
位于System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs参数)
在System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex EntryIndex,DependencyProperty dp,PropertyMetadata,EffectiveValueEntry oldEntry,EffectiveValueEntry&newEntry,布尔强制WithDeferredReference,布尔强制WithCurrentValue,OperationType OperationType)
位于System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp、对象值、PropertyMetadata元数据、布尔强制WithDeferredReference、布尔强制WithCurrentValue、OperationType OperationType、布尔isInternal)
位于System.Windows.DependencyObject.SetValue(DependencyPropertyKey,对象值)
位于Infragistics.Windows.Ribbon.MenuToolBase.SetLocation(DependencyObject元素,对象项)
在Infragistics.Windows.Ribbon.MenuToolBase.PrepareContainerForItemOverride(DependencyObject元素,对象项)中
位于Infragistics.Windows.Ribbon.MenuToolBase.PrepareContainerForItemInternal(ToolMenuItem parentMenuItem、DependencyObject元素、对象项)
位于Infragistics.Windows.Ribbon.ToolMenuItem.PrepareContainerForItemOverride(DependencyObject元素,对象项)
位于System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject容器,对象项)
位于System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainerGenerator(DependencyObject容器)
在System.Windows.Controls.Panel.GenerateChildren()中
在System.Windows.Controls.Panel.Regenerator()中
在System.Windows.Controls.Panel.get_InternalChildren()中
位于Infragistics.Windows.Ribbon.Internal.MenuToolPanel.MeasureOverride(可用大小大小)
位于System.Windows.FrameworkElement.MeasureCore(可用大小大小)
位于System.Windows.UIElement.Measure(可用大小大小)
在MS.Internal.Helper.MeasureElementWithSingleChild(UIElement元素,大小约束)
位于System.Windows.Controls.ItemsPresenter.MeasureOverride(大小约束)
位于System.Windows.FrameworkElement.MeasureCore(可用大小大小)
位于System.Windows.UIElement.Measure(可用大小大小)
在MS.Internal.Helper.MeasureElementWithSingleChild(UIElement元素,大小约束)
位于System.Windows.Controls.ScrollContentPresenter.MeasureOverride(大小约束)
位于System.Windows.FrameworkElement.MeasureCore(可用大小大小)
位于System.Windows.UIElement.Measure(可用大小大小)
位于System.Windows.Controls.Border.MeasureOverride(大小约束)
位于System.Windows.FrameworkElement.MeasureCore(可用大小大小)
位于System.Windows.UIElement.Measure(可用大小大小)
位于System.Windows.Controls.Grid.MeasureCell(Int32单元格,布尔值forceInfinityV)
在System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead,Size referenceSize,Boolean ignoreDesiredSizeU,