Simple Application of AvalonDock 2.0

Source: Internet
Author: User

Some problems have been encountered in the use of AvalonDock recently. Now let's share it with you.

I found the token on the Internet and found that the attribute Panel (DockableContent) was set to floating and cannot be docked to other panels. Finally, we had to try AvalonDock version 2.0. Fortunately, version 2.0 didn't disappoint us.

First, the library file: Xceed. wpf. avalonDock. If you need Aero or VS2010 theme effects, you need to reference Xceed. wpf. avalonDock. themes. aero or Xceed. wpf. avalonDock. themes. VS2010, of course, there are other beautiful themes can be downloaded on the official website (http://avalondock.codeplex.com.

First, you need to introduce these dll files in the xaml File Header (before that, of course, you have to introduce the library files mentioned earlier into the project ):

xmlns:avalonDock="http://schemas.xceed.com/wpf/xaml/avalondock"

Xaml layout code:

View Code

 

Effect:

 

 

 

 

<AvalonDock: LayoutAnchorablePane> and <avalonDock: LayoutDocumentPane> are called attribute layout panels and Document Layout panels respectively. The property layout Panel can be automatically hidden when it is docked at the edge of the Panel, and the property layout panel can also be used as a dock panel for other property layout panels to dock. The document layout panel can only float and dock in the main layout panel, but not in the property layout panel.

<AvalonDock: LayoutAnchorablePane> and <avalonDock: LayoutDocumentPane> the layout panel must be in the <avalonDock: LayoutPanel> layout panel, if you need to set multiple attribute layout panels and Document Layout panels to one panel group, you can use <avalonDock: LayoutAnchorablePaneGroup> and <avalonDock: LayoutDocumentPaneGroup> respectively.

<AvalonDock: LayoutAnchorable> and <avalonDock: LayoutDocument> are bearing our content controls. We can add our own content to them. They can only be placed in <avalonDock: LayoutAnchorablePane> and <avalonDock: LayoutDocumentPane>. You can combine them based on your needs.

The Layout is here. Next let's take a look at how to save and restore the Layout. AvalonDock 2.0 provides the corresponding operation class XmlLayoutSerializer. You need to add reference using Xceed. Wpf. AvalonDock. Layout. Serialization;

Cs code:

                      serializer =  ( stream =  StreamWriter(
               serializer =  ( stream =  StreamReader(

 

The Save deployment board stores the current layout (dmanager‑existing file ‑lay.txt‑in, and the recovery deployment board restores the layout content in the ‑lay.txt "to the interface (DManager. Note that the ContentId attribute must be added to each content panel when using this function, as shown in <avalonDock: LayoutAnchorable Title = "left1" AutoHideWidth = "50" ContentId = "left1">, otherwise, it cannot be restored.

The sharing is over. In fact, AvalonDock has many other functions, such as <avalonDock: DockingManager. anchorableHeaderTemplate> is the custom content in the header of the attribute content interface. The level is limited. Please forgive me for the possible omission in the content.

 

Source code download

 

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.