This example demonstrates how to build a dock UI according to the MVVM design pattern using the LayoutAdapter. More information on this approach can be found at: MVVM Support - Building Dock UI
Another approach to building a dock UI according to the MVVM design pattern is shown in the example: E20026: How to use the IMVVMDockingProperties interface in an MVVM application .
Question Comments
Added By: Kun Wang 1 at: 8/10/2016 10:44:40 PM NullReferenceException happens when run this demo.
Added By: Andrey Marten (DevExpress Support) at: 8/10/2016 11:54:55 PM[C#]System.NullReferenceExceptionwasunhandled HResult=-2147467261 Message=Objectreferencenotsettoaninstanceofanobject. Source=PresentationFramework StackTrace: atSystem.Windows.ResourceDictionary.GetKeyValue(KeyRecordkey,IServiceProviderserviceProvider) atSystem.Windows.ResourceDictionary.SetKeys(IList`1 keyCollection,IServiceProviderserviceProvider) atSystem.Windows.ResourceDictionary.SetDeferrableContent(DeferrableContentdeferrableContent) atSystem.Windows.Baml2006.WpfSharedBamlSchemaContext.<>c.<Create_BamlProperty_ResourceDictionary_DeferrableContent>b__297_0(Objecttarget,Objectvalue) atSystem.Windows.Baml2006.WpfKnownMemberInvoker.SetValue(Objectinstance,Objectvalue) atMS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(XamlMembermember,Objectobj,Objectvalue) atMS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Objectinst,XamlMemberproperty,Objectvalue) atSystem.Xaml.XamlObjectWriter.Logic_ApplyPropertyValue(ObjectWriterContextctx,XamlMemberprop,Objectvalue,BooleanonParent) atSystem.Xaml.XamlObjectWriter.Logic_DoAssignmentToParentProperty(ObjectWriterContextctx) atSystem.Xaml.XamlObjectWriter.WriteEndMember() atSystem.Xaml.XamlWriter.WriteNode(XamlReaderreader) atSystem.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReaderxamlReader,XamlObjectWriterxamlWriter,BooleanonlyLoadOneNode,BooleanskipJournaledProperties,BooleanshouldPassLineNumberInfo,IXamlLineInfoxamlLineInfo,IXamlLineInfoConsumerxamlLineInfoConsumer,XamlContextStack`1 stack,IStyleConnectorstyleConnector) atSystem.Windows.Markup.WpfXamlLoader.Load(XamlReaderxamlReader,IXamlObjectWriterFactorywriterFactory,BooleanskipJournaledProperties,ObjectrootObject,XamlObjectWriterSettingssettings,UribaseUri) atSystem.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReaderxamlReader,BooleanskipJournaledProperties,ObjectrootObject,XamlAccessLevelaccessLevel,UribaseUri) atSystem.Windows.Markup.XamlReader.LoadBaml(Streamstream,ParserContextparserContext,Objectparent,BooleancloseStream) atSystem.Windows.Application.LoadBamlStreamWithSyncInfo(Streamstream,ParserContextpc) atMS.Internal.AppModel.AppModelKnownContentFactory.BamlConverter(Streamstream,UribaseUri,BooleancanUseTopLevelBrowser,BooleansandboxExternalContent,BooleanallowAsync,BooleanisJournalNavigation,XamlReader&asyncObjectConverter) atMS.Internal.AppModel.MimeObjectFactory.GetObjectAndCloseStream(Streams,ContentTypecontentType,UribaseUri,BooleancanUseTopLevelBrowser,BooleansandboxExternalContent,BooleanallowAsync,BooleanisJournalNavigation,XamlReader&asyncObjectConverter) atSystem.Windows.ResourceDictionary.set_Source(Urivalue) atSystem.Windows.Baml2006.WpfSharedBamlSchemaContext.<>c.<Create_BamlProperty_ResourceDictionary_Source>b__342_0(Objecttarget,Objectvalue) atSystem.Windows.Baml2006.WpfKnownMemberInvoker.SetValue(Objectinstance,Objectvalue) atMS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(XamlMembermember,Objectobj,Objectvalue) atMS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Objectinst,XamlMemberproperty,Objectvalue) atMS.Internal.Xaml.Runtime.PartialTrustTolerantRuntime.SetValue(Objectobj,XamlMemberproperty,Objectvalue) atSystem.Xaml.XamlObjectWriter.Logic_ApplyPropertyValue(ObjectWriterContextctx,XamlMemberprop,Objectvalue,BooleanonParent) atSystem.Xaml.XamlObjectWriter.Logic_DoAssignmentToParentProperty(ObjectWriterContextctx) atSystem.Xaml.XamlObjectWriter.Logic_AssignProvidedValue(ObjectWriterContextctx) atSystem.Xaml.XamlObjectWriter.WriteEndObject() atSystem.Xaml.XamlWriter.WriteNode(XamlReaderreader) atSystem.Xaml.XamlServices.Transform(XamlReaderxamlReader,XamlWriterxamlWriter,BooleancloseWriter) atSystem.Xaml.XamlServices.Transform(XamlReaderxamlReader,XamlWriterxamlWriter) atSystem.Windows.SystemResources.ResourceDictionaries.LoadDictionary(Assemblyassembly,StringassemblyName,StringresourceName,BooleanisTraceEnabled) atSystem.Windows.SystemResources.ResourceDictionaries.LoadGenericDictionary(BooleanisTraceEnabled) atSystem.Windows.SystemResources.FindDictionaryResource(Objectkey,TypetypeKey,ResourceKeyresourceKey,BooleanisTraceEnabled,BooleanallowDeferredResourceReference,BooleanmustReturnDeferredResourceReference,Boolean&canCache) atSystem.Windows.SystemResources.FindResourceInternal(Objectkey,BooleanallowDeferredResourceReference,BooleanmustReturnDeferredResourceReference) atSystem.Windows.StyleHelper.GetThemeStyle(FrameworkElementfe,FrameworkContentElementfce) atSystem.Windows.FrameworkElement.UpdateThemeStyleProperty() atSystem.Windows.FrameworkElement.OnInitialized(EventArgse) atSystem.Windows.FrameworkElement.TryFireInitialized() atSystem.Windows.FrameworkElement.EndInit() atSystem.Windows.Controls.ItemsControl.EndInit() atMS.Internal.Xaml.Runtime.ClrObjectRuntime.InitializationGuard(XamlTypexamlType,Objectobj,Booleanbegin) atSystem.Xaml.XamlObjectWriter.Logic_EndInit(ObjectWriterContextctx) atSystem.Xaml.XamlObjectWriter.WriteEndObject() atSystem.Xaml.XamlWriter.WriteNode(XamlReaderreader) atSystem.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReadertemplateReader,XamlObjectWritercurrentWriter) atSystem.Windows.FrameworkTemplate.LoadTemplateXaml(XamlObjectWriterobjectWriter) atSystem.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObjectcontainer,IComponentConnectorcomponentConnector,IStyleConnectorstyleConnector,List`1 affectedChildren,UncommonField`1 templatedNonFeChildrenField) atSystem.Windows.FrameworkTemplate.LoadContent(DependencyObjectcontainer,List`1 affectedChildren) atSystem.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField,DependencyObjectcontainer,FrameworkElementFactorytemplateRoot,Int32lastChildIndex,HybridDictionarychildIndexFromChildID,FrameworkTemplateframeworkTemplate) atSystem.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField,FrameworkElementcontainer) atSystem.Windows.FrameworkElement.ApplyTemplate() atSystem.Windows.FrameworkElement.MeasureCore(SizeavailableSize) atSystem.Windows.UIElement.Measure(SizeavailableSize) atSystem.Windows.Controls.Grid.MeasureOverride(Sizeconstraint) atSystem.Windows.FrameworkElement.MeasureCore(SizeavailableSize) atSystem.Windows.UIElement.Measure(SizeavailableSize) atMS.Internal.Helper.MeasureElementWithSingleChild(UIElementelement,Sizeconstraint) atSystem.Windows.Controls.ContentPresenter.MeasureOverride(Sizeconstraint) atSystem.Windows.FrameworkElement.MeasureCore(SizeavailableSize) atSystem.Windows.UIElement.Measure(SizeavailableSize) atSystem.Windows.Documents.AdornerDecorator.MeasureOverride(Sizeconstraint) atSystem.Windows.FrameworkElement.MeasureCore(SizeavailableSize) atSystem.Windows.UIElement.Measure(SizeavailableSize) atSystem.Windows.Controls.Border.MeasureOverride(Sizeconstraint) atSystem.Windows.FrameworkElement.MeasureCore(SizeavailableSize) atSystem.Windows.UIElement.Measure(SizeavailableSize) atSystem.Windows.Window.MeasureOverrideHelper(Sizeconstraint) atSystem.Windows.Window.MeasureOverride(SizeavailableSize) atSystem.Windows.FrameworkElement.MeasureCore(SizeavailableSize) atSystem.Windows.UIElement.Measure(SizeavailableSize) atSystem.Windows.Interop.HwndSource.SetLayoutSize() atSystem.Windows.Interop.HwndSource.set_RootVisualInternal(Visualvalue) atSystem.Windows.Interop.HwndSource.set_RootVisual(Visualvalue) atSystem.Windows.Window.SetRootVisual() atSystem.Windows.Window.SetRootVisualAndUpdateSTC() atSystem.Windows.Window.SetupInitialState(DoublerequestedTop,DoublerequestedLeft,DoublerequestedWidth,DoublerequestedHeight) atSystem.Windows.Window.CreateSourceWindow(BooleanduringShow) atSystem.Windows.Window.CreateSourceWindowDuringShow() atSystem.Windows.Window.SafeCreateWindowDuringShow() atSystem.Windows.Window.ShowHelper(ObjectbooleanBox) atSystem.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegatecallback,Objectargs,Int32numArgs) atSystem.Windows.Threading.ExceptionWrapper.TryCatchWhen(Objectsource,Delegatecallback,Objectargs,Int32numArgs,DelegatecatchHandler) atSystem.Windows.Threading.DispatcherOperation.InvokeImpl() atSystem.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Objectstate) atSystem.Threading.ExecutionContext.RunInternal(ExecutionContextexecutionContext,ContextCallbackcallback,Objectstate,BooleanpreserveSyncCtx) atSystem.Threading.ExecutionContext.Run(ExecutionContextexecutionContext,ContextCallbackcallback,Objectstate,BooleanpreserveSyncCtx) atSystem.Threading.ExecutionContext.Run(ExecutionContextexecutionContext,ContextCallbackcallback,Objectstate) atMS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContextexecutionContext,ContextCallbackcallback,Objectstate) atSystem.Windows.Threading.DispatcherOperation.Invoke() atSystem.Windows.Threading.Dispatcher.ProcessQueue() atSystem.Windows.Threading.Dispatcher.WndProcHook(IntPtrhwnd,Int32msg,IntPtrwParam,IntPtrlParam,Boolean&handled) atMS.Win32.HwndWrapper.WndProc(IntPtrhwnd,Int32msg,IntPtrwParam,IntPtrlParam,Boolean&handled) atMS.Win32.HwndSubclass.DispatcherCallbackOperation(Objecto) atSystem.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegatecallback,Objectargs,Int32numArgs) atSystem.Windows.Threading.ExceptionWrapper.TryCatchWhen(Objectsource,Delegatecallback,Objectargs,Int32numArgs,DelegatecatchHandler) atSystem.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPrioritypriority,TimeSpantimeout,Delegatemethod,Objectargs,Int32numArgs) atMS.Win32.HwndSubclass.SubclassWndProc(IntPtrhwnd,Int32msg,IntPtrwParam,IntPtrlParam) atMS.Win32.UnsafeNativeMethods.DispatchMessage(MSG&msg) atSystem.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrameframe) atSystem.Windows.Threading.Dispatcher.PushFrame(DispatcherFrameframe) atSystem.Windows.Application.RunDispatcher(Objectignore) atSystem.Windows.Application.RunInternal(Windowwindow) atSystem.Windows.Application.Run(Windowwindow) atSystem.Windows.Application.Run() atDevExpressDemo.DockUI.MvvmWithLayoutAdapter.App.Main()inC:\Kun\Codes\Kun.Demo.DX.DockLayoutManager.Performance\DevExpressDemo.DockUI.MvvmWithLayoutAdapter\obj\Debug\App.g.cs:line 0 atSystem.AppDomain._nExecuteAssembly(RuntimeAssemblyassembly,String[]args) atSystem.AppDomain.ExecuteAssembly(StringassemblyFile,EvidenceassemblySecurity,String[]args) atMicrosoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() atSystem.Threading.ThreadHelper.ThreadStart_Context(Objectstate) atSystem.Threading.ExecutionContext.RunInternal(ExecutionContextexecutionContext,ContextCallbackcallback,Objectstate,BooleanpreserveSyncCtx) atSystem.Threading.ExecutionContext.Run(ExecutionContextexecutionContext,ContextCallbackcallback,Objectstate,BooleanpreserveSyncCtx) atSystem.Threading.ExecutionContext.Run(ExecutionContextexecutionContext,ContextCallbackcallback,Objectstate) atSystem.Threading.ThreadHelper.ThreadStart()
Hello,
I've created a separate ticket on your behalf (T413639: NullReferenceException is raised when project from T273592 is started). It has been placed in our processing queue and will be answered shortly.
Thanks,
Andrey