The warning comes from ReSharper, and simply states "DataGridContext is not accessible." Because this differed from the documentation we inspected the assembly using Reflector and it also identified the property as internal.
I've commented out the trigger using the DependentOn Property before running to rule out the possibility that my implementation of that section is the cause. I also tried to place a very simple style in DataGridControl.Resources that used a reference to DataGridContext, using the same binding as in the example template. In that case, I get the innermost exception below, the NullReferenceException.
The full exception detail is as follows:
System.Reflection.TargetInvocationException was unhandled
Message="Exception has been thrown by the target of an invocation."
Source="mscorlib"
StackTrace:
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.TranslateAndDispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Application.RunInternal(Window window)
at NewWorld.Aegis.Dispatch.Desktop.App.Main() in C:\Code\TFS\CAD\Dispatch\DEV\Client\AegisDispatch\obj\Debug\App.g.cs:line 50
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: Microsoft.Practices.Unity.ResolutionFailedException
Message="Resolution of the dependency failed, type = \"NewWorld.Aegis.Dispatch.Core.UnitPersonnel.IUnitPersonnelPresentationModel\", name = \"\". Exception message is: The current build operation (build key Build Key[NewWorld.Aegis.Dispatch.Core.UnitPersonnel.UnitPersonnelPresentationModel, null]) failed: The parameter view could not be resolved when attempting to call constructor NewWorld.Aegis.Dispatch.Core.UnitPersonnel.UnitPersonnelPresentationModel(NewWorld.Aegis.Dispatch.Core.UnitPersonnel.IUnitPersonnelView view, NewWorld.Aegis.Dispatch.Interface.IDispatchService dispatchService, NewWorld.Aegis.Dispatch.Interface.CommandProcessing.ICommandProcessorService commandProcessorService). (Strategy type BuildPlanStrategy, index 3)"
Source="Microsoft.Practices.Unity"
TypeRequested="IUnitPersonnelPresentationModel"
StackTrace:
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name)
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name)
at Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name)
at Microsoft.Practices.Unity.UnityContainerBase.Resolve(Type t)
at Microsoft.Practices.Unity.UnityContainerBase.Resolve[T]()
at NewWorld.Aegis.Dispatch.Core.Controller.CoreController.DisplayUnitPersonnel(Unit unit) in C:\Code\TFS\CAD\Dispatch\DEV\Client\Modules\Core\Controller\CoreController.cs:line 342
InnerException: Microsoft.Practices.ObjectBuilder2.BuildFailedException
Message="The current build operation (build key Build Key[NewWorld.Aegis.Dispatch.Core.UnitPersonnel.UnitPersonnelPresentationModel, null]) failed: The parameter view could not be resolved when attempting to call constructor NewWorld.Aegis.Dispatch.Core.UnitPersonnel.UnitPersonnelPresentationModel(NewWorld.Aegis.Dispatch.Core.UnitPersonnel.IUnitPersonnelView view, NewWorld.Aegis.Dispatch.Interface.IDispatchService dispatchService, NewWorld.Aegis.Dispatch.Interface.CommandProcessing.ICommandProcessorService commandProcessorService). (Strategy type BuildPlanStrategy, index 3)"
Source="Microsoft.Practices.ObjectBuilder2"
BuildKey="Build Key[NewWorld.Aegis.Dispatch.Core.UnitPersonnel.UnitPersonnelPresentationModel, null]"
ExecutingStrategyIndex=3
ExecutingStrategyTypeName="BuildPlanStrategy"
StackTrace:
at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.Builder.BuildUp(IReadWriteLocator locator, ILifetimeContainer lifetime, IPolicyList policies, IStrategyChain strategies, Object buildKey, Object existing)
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name)
InnerException: System.InvalidOperationException
Message="The parameter view could not be resolved when attempting to call constructor NewWorld.Aegis.Dispatch.Core.UnitPersonnel.UnitPersonnelPresentationModel(NewWorld.Aegis.Dispatch.Core.UnitPersonnel.IUnitPersonnelView view, NewWorld.Aegis.Dispatch.Interface.IDispatchService dispatchService, NewWorld.Aegis.Dispatch.Interface.CommandProcessing.ICommandProcessorService commandProcessorService)."
Source="Microsoft.Practices.ObjectBuilder2"
StackTrace:
at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.ThrowForResolutionFailed(Exception inner, String parameterName, String constructorSignature, IBuilderContext context)
at BuildUp_NewWorld.Aegis.Dispatch.Core.UnitPersonnel.UnitPersonnelPresentationModel(IBuilderContext )
at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
InnerException: Microsoft.Practices.ObjectBuilder2.BuildFailedException
Message="The current build operation (build key Build Key[NewWorld.Aegis.Dispatch.Core.UnitPersonnel.UnitPersonnelView, null]) failed: Object reference not set to an instance of an object. (Strategy type BuildPlanStrategy, index 3)"
Source="Microsoft.Practices.ObjectBuilder2"
BuildKey="Build Key[NewWorld.Aegis.Dispatch.Core.UnitPersonnel.UnitPersonnelView, null]"
ExecutingStrategyIndex=3
ExecutingStrategyTypeName="BuildPlanStrategy"
StackTrace:
at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
at Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(IBuilderContext context)
at BuildUp_NewWorld.Aegis.Dispatch.Core.UnitPersonnel.UnitPersonnelPresentationModel(IBuilderContext )
InnerException: System.NullReferenceException
Message="Object reference not set to an instance of an object."
Source="PresentationFramework"
StackTrace:
at System.Windows.Markup.XmlnsCache.GetClrnsToAssemblyNameMappingList(Assembly[] asmList, String xmlnsRequested)
at System.Windows.Markup.XmlnsCache.GetMappingArray(String xmlns)
at System.Windows.Markup.XamlTypeMapper.GetClrNamespacePairFromCache(String namespaceUri)
at System.Windows.Markup.XamlTypeMapper.GetNamespaceMapEntries(String xmlNamespace)
at System.Windows.Markup.XamlTypeMapper.CreateTypeAndSerializer(String xmlNamespace, String localName)
at System.Windows.Markup.XamlTypeMapper.GetTypeOnly(String xmlNamespace, String localName)
at System.Windows.PropertyPath.GetTypeFromName(String name, Object context)
at System.Windows.PropertyPath.ResolvePropertyName(String name, Object item, Type ownerType, Object context, Boolean throwOnError)
at System.Windows.PropertyPath.ResolvePathParts(ITypeDescriptorContext typeDescriptorContext)
at System.Windows.PropertyPath..ctor(String path, ITypeDescriptorContext typeDescriptorContext)
at System.Windows.PropertyPathConverter.ConvertFrom(ITypeDescriptorContext typeDescriptorContext, CultureInfo cultureInfo, Object source)
at System.Windows.Markup.XamlTypeMapper.ParseProperty(Object targetObject, Type propType, String propName, Object dpOrPiOrFi, ITypeDescriptorContext typeContext, ParserContext parserContext, String value, Int16 converterTypeId)
at System.Windows.Markup.BamlRecordReader.ParseProperty(Object element, Type propertyType, String propertyName, Object dpOrPi, String attribValue, Int16 converterTypeId)
at System.Windows.Markup.BamlRecordReader.ReadPropertyRecordBase(String attribValue, Int16 attributeId, Int16 converterTypeId)
at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
at System.Windows.Markup.StyleBamlRecordReader.ReadRecord(BamlRecord bamlRecord)
at System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)
at System.Windows.Markup.StyleTreeBuilderBamlTranslator.ParseFragment()
at System.Windows.Markup.TreeBuilder.Parse()
at System.Windows.Markup.XamlStyleSerializer.ConvertBamlToObject(BamlRecordReader reader, BamlRecord bamlRecord, ParserContext context)
at System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
at System.Windows.Markup.BamlRecordReader.ReadElement(Int64 startPosition, XamlObjectIds contextXamlObjectIds, Object dictionaryKey)
at System.Windows.ResourceDictionary.CreateObject(Int32 valuePosition, Object key)
at System.Windows.ResourceDictionary.RealizeDeferContent(Object key, Object& value, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
at System.Windows.FrameworkElement.FindResourceOnSelf(Object resourceKey, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference)
at System.Windows.Markup.BamlRecordReader.FindResourceInParserStack(Object resourceNameObject, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference)
at System.Windows.Markup.BamlRecordReader.FindResourceInParentChain(Object resourceNameObject, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference)
at System.Windows.StaticResourceExtension.ProvideValueInternal(IBamlReader bamlReader, Object targetObject, Object targetProperty, Boolean allowDeferredReference)
at System.Windows.StaticResourceExtension.ProvideValue(IServiceProvider serviceProvider)
at System.Windows.Markup.BamlRecordReader.ProvideValueFromMarkupExtension(MarkupExtension markupExtension, Object obj, Object member)
at System.Windows.Markup.BamlRecordReader.BaseReadOptimizedMarkupExtension(Object element, Int16 attributeId, PropertyDefinition propertyDefinition, Object value)
at System.Windows.Markup.BamlRecordReader.ReadPropertyWithExtensionRecord(BamlPropertyWithExtensionRecord bamlPropertyRecord)
at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
at System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)
at System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment()
at System.Windows.Markup.TreeBuilder.Parse()
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at NewWorld.Aegis.Dispatch.Core.UnitPersonnel.UnitPersonnelView.InitializeComponent() in c:\Code\TFS\CAD\Dispatch\DEV\Client\Modules\Core\UnitPersonnel\UnitPersonnelView.xaml:line 1
at NewWorld.Aegis.Dispatch.Core.UnitPersonnel.UnitPersonnelView..ctor() in C:\Code\TFS\CAD\Dispatch\DEV\Client\Modules\Core\UnitPersonnel\UnitPersonnelView.xaml.cs:line 29
at BuildUp_NewWorld.Aegis.Dispatch.Core.UnitPersonnel.UnitPersonnelView(IBuilderContext )
at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
InnerException: