AvalonDock 2.0 + Caliburn. Micro + MahApps. Metro-style plug-in system (II)

Source: Internet
Author: User

This article describes how to automatically load the custom View and add it to AvalonDock. There are three types of UI parts in AvalonDock: Document, dockableContent and Floting types. I will mainly talk about the addition of Document and DockableContent. For details about Document types in AvalonDock, see VS. DockableContent is equivalent to the toolbar in VS. Then I will directly go. write comments and parse In the cs file.

Current project structure:

Running result:

  

We can see that there is an additional Document for testing. This Document is automatically loaded by MEF and bound to AvalonDock. Here I only write one Document. If you are interested, try it by yourself, the current Document is written in the main program. In fact, this Document should be written in a separate DLL. This is what we call the plug-in. [BY Zengg]

DockScreenManager class

ObservableCollection <IDocument> events {ObservableCollection <IDockableContent> DockableContents {ObservableCollection <IDocument> events {; ObservableCollection <IDockableContent> DockableContents {;}DockScreenManager

DocumentBase class

NotifyOfPropertyChange (}DocumentBase

IDockScreen Interface

DockType Type {; DockSide Side {; DisplayName {;}IDockScreen

IDocument Interface

}IDocument

PanesStyleSelector class

                                                                                                                                                                           Style SelectStyle(              IDockScreen obj =                           (item !=                                     (item                                                                                               }

Compared with the first change:

DockViewModel class

                        [Export(,                              :      }

ShellViewModel class

       [Export(                                       .windowManager =                                        [Import(          IDockScreenManager DockContent { ;   }

MefBootstrapper class

Catalog = AssemblySource. instance. select (x => AssemblyCatalog (x )). ofType <ComposablePartCatalog> container = batch = dockScreenManage = batch. addExportedValue <IWindowManager> (WindowManager (); batch. addExportedValue <IEventAggregator> (batch. addExportedValue <IDockScreenManager> container. compose (batch); container. composeParts (container. getExportedValue <IDockScreenManager> ());}MefBootstrapper

AvalonDock also supports several other skins to meet the needs of the masses:

AeroTheme

ExpressionLightTheme

ExpressionDarkTheme

VS2010Theme

The implementation of the DockableContent type is the same as that of the Document type, but the implementation interface is different. DockableContent implements the IDockableContent interface. For details, refer to Document implementation. If you have any questions, you can raise them, try to help solve the problem. The explanation is a little simple. Sorry, but there is a source code reference. If the source code is helpful to everyone, I 'd like to ask for a recommendation, a reply, or a fan's magic horse...

Source Code address:

Http://pan.baidu.com/share/link? Consumer id = 819683340 & uk = 554439928

 

 

If you have read this blog and think it is helpful to you, click [recommendation] in the lower right corner.

If you want to repost this blog, please indicate the source

If you have any comments or suggestions for this article, please leave a message.

Thank you for reading this article. Please follow up on my blog

Author: Zengg Source: http://www.cnblogs.com/01codeworld/

The copyright of this article is shared by the author and the blog Park. You are welcome to repost this article. However, you must retain this statement without the author's consent and provide a clear link to the original article on the article page. Otherwise, you will be held legally liable.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.