[Telerik] Raddocking No. 02 Save and load the layout of raddocking

Source: Internet
Author: User

I. Overview of the Presentation
This demo shows how to save layout information through the Savelayout () provided by the Raddocking control itself, and to load layout information through the Loadlayout () method. As a result, you can persist user-defined layout information to a file, and when the user opens the app again, you can restore the layout intact.
Related downloads (screen recording): http://pan.baidu.com/s/1gd6DwDt
Play Online: http://v.youku.com/v_show/id_XODcyNjE0Mjg4.html
Warm Tips: If the screen recording and code can not be downloaded properly, you can leave a message in the station, or send an email to [email protected]

second, the operation effect
The effect is as follows:


Three, the key code
1, save the layout of the Code

<summary>///converts the layout information of the raddocking to a string. </summary>///<returns></returns>private String savelayoutasstring () {MemoryStream stream = new MemoryStream (); Raddocking.savelayout (stream); stream. Seek (0, Seekorigin.begin); StreamReader reader = new StreamReader (stream), return reader. ReadToEnd ();}

2. Loading the layout code
<summary>///loads the raddocking layout information from the string. </summary>///<param name= "xml" ></param>private void Loadlayoutfromstring (string xml) {using ( Stream stream = new MemoryStream (Encoding.UTF8.GetBytes (XML))) {stream. Seek (0, Seekorigin.begin); Raddocking.loadlayout (stream);}}

3. Persisting the generated XML
The raddocking layout persists the resulting string, which is also an XML, which is roughly as follows:
<?xml version= "1.0" encoding= "Utf-8"?><raddocking> <DocumentHost> <RadSplitContainer> &lt ;items> <radpanegroup selectedindex= "0" > <Items> <radpane serializationtag= "L Ayoutxml "isdockable=" True "header=" Layout Xml "/> <raddocumentpa Ne serializationtag= "documentpane" isdockable= "True" title= "Docume NT 1 "header=" Document 1 "/> </Items> </RadPaneGroup> < /items> </RadSplitContainer> </DocumentHost> <SplitContainers> <radsplitcontainer dock= "do          Ckedleft "Width=" > <Items> <radpanegroup selectedindex= "0" >                     <Items> <radpane serializationtag= "PaneLeft1" isdockable= "True" Header= "Pane left 1"/> <radpane serializationtag= "PaneLeft2" isdockable= "True" header=                     "Pane left 2"/> <radpane serializationtag= "PaneLeft3" isdockable= "True" Header= "Pane left 3"/> <radpane serializationtag= "PaneLeft4" isdockable= "Tru     E "header=" Pane Left 4 "/> </Items> </RadPaneGroup> </Items> </RadSplitContainer> <radsplitcontainer dock= "Dockedright" width= "Up" > < items> <radpanegroup selectedindex= "0" > <Items> <radpane serializationtag= "Pa        NeRight1 "isdockable=" True "header=" Pane right 1 "/> </Items>                       </RadPaneGroup> </Items> </RadSplitContainer> <radsplitcontainer dock= "Dockedtop" Height= "> <Items> <radpanegroup selectedindex=" 0 "> <Items> <radpane          Serializationtag= "PaneTop1" isdockable= "True" header= "Pane Top 1"/> </Items> </RadPaneGroup> </Items> </RadSplitContainer> </splitcontainers>&lt ;/raddocking>

Iv. Related Resources
1, Telerik official Help document address: Http://docs.telerik.com/devtools/wpf/controls/raddocking/overview2



[Telerik] Raddocking No. 02 Save and load the layout of raddocking

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.