{"action":"created","issue":{"url":"https://api.github.com/repos/XceedBoucherS/TestImport5/issues/1112","repository_url":"https://api.github.com/repos/XceedBoucherS/TestImport5","labels_url":"https://api.github.com/repos/XceedBoucherS/TestImport5/issues/1112/labels{/name}","comments_url":"https://api.github.com/repos/XceedBoucherS/TestImport5/issues/1112/comments","events_url":"https://api.github.com/repos/XceedBoucherS/TestImport5/issues/1112/events","html_url":"https://github.com/XceedBoucherS/TestImport5/issues/1112","id":242023597,"number":1112,"title":"AvalonDock: Serialization broken at least since 3.2.","user":{"login":"XceedBoucherS","id":29377763,"avatar_url":"https://avatars1.githubusercontent.com/u/29377763?v=3","gravatar_id":"","url":"https://api.github.com/users/XceedBoucherS","html_url":"https://github.com/XceedBoucherS","followers_url":"https://api.github.com/users/XceedBoucherS/followers","following_url":"https://api.github.com/users/XceedBoucherS/following{/other_user}","gists_url":"https://api.github.com/users/XceedBoucherS/gists{/gist_id}","starred_url":"https://api.github.com/users/XceedBoucherS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XceedBoucherS/subscriptions","organizations_url":"https://api.github.com/users/XceedBoucherS/orgs","repos_url":"https://api.github.com/users/XceedBoucherS/repos","events_url":"https://api.github.com/users/XceedBoucherS/events{/privacy}","received_events_url":"https://api.github.com/users/XceedBoucherS/received_events","type":"User","site_admin":false},"labels":[{"id":644079708,"url":"https://api.github.com/repos/XceedBoucherS/TestImport5/labels/CodePlex","name":"CodePlex","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-07-11T12:04:08Z","updated_at":"2017-07-11T12:04:42Z","closed_at":null,"body":"<b>Dige[CodePlex]</b> <br />If using MVVM bindings (AnchorablesSource and DocumentsSource) both the serialization and the deserialization of the layout is completely broken. Docking panels to the top or bottom won't get saved at all.\r\n\r\nThe easiest way to reproduce this is to check out this example: \r\nhttps://www.codeproject.com/Articles/719143/AvalonDock-Tutorial-Part-Load-Save-Layout where the saving still works and then update the AvalonDock to the latest version and see that the serialization is broken.\r\n"},"comment":{"url":"https://api.github.com/repos/XceedBoucherS/TestImport5/issues/comments/314422561","html_url":"https://github.com/XceedBoucherS/TestImport5/issues/1112#issuecomment-314422561","issue_url":"https://api.github.com/repos/XceedBoucherS/TestImport5/issues/1112","id":314422561,"user":{"login":"XceedBoucherS","id":29377763,"avatar_url":"https://avatars1.githubusercontent.com/u/29377763?v=3","gravatar_id":"","url":"https://api.github.com/users/XceedBoucherS","html_url":"https://github.com/XceedBoucherS","followers_url":"https://api.github.com/users/XceedBoucherS/followers","following_url":"https://api.github.com/users/XceedBoucherS/following{/other_user}","gists_url":"https://api.github.com/users/XceedBoucherS/gists{/gist_id}","starred_url":"https://api.github.com/users/XceedBoucherS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XceedBoucherS/subscriptions","organizations_url":"https://api.github.com/users/XceedBoucherS/orgs","repos_url":"https://api.github.com/users/XceedBoucherS/repos","events_url":"https://api.github.com/users/XceedBoucherS/events{/privacy}","received_events_url":"https://api.github.com/users/XceedBoucherS/received_events","type":"User","site_admin":false},"created_at":"2017-07-11T12:04:42Z","updated_at":"2017-07-11T12:04:42Z","body":"<b>BoucherS[CodePlex]</b> <br />Hi, \r\n\r\nYes, there is a bug.\r\nUpon de-serialization, a new RootPanel is created, but its orientation is always horizontal. This explains why when you dock a LayoutAnchorable on top/bottom, the de-serialization shows you horizontal panels, instead of Vertical panels.\r\n\r\n\r\nYou can fix if by going in file Xceed.Wpf.AvalonDock/Layout/LayoutRoot.cs, and doing the 2 fixes :\r\n1) in method ReadXml, replace :\r\nvar layoutPanelElements = this.ReadRootPanel( reader );\r\n  if( layoutPanelElements != null )\n  {\n    this.RootPanel = new LayoutPanel();\n    //Add all children to RootPanel\n    for( int i = 0; i  layoutPanelElements.Count; ++i )\n    {\n      this.RootPanel.Children.Add( layoutPanelElements[ i ] );\n    }\n  }\n\r\nwith \r\n\r\nOrientation orientation;\r\n  var layoutPanelElements = this.ReadRootPanel( reader, out orientation );\n  if( layoutPanelElements != null )\n  {\n    this.RootPanel = new LayoutPanel() { Orientation = orientation };\n    //Add all children to RootPanel\n    for( int i = 0; i  layoutPanelElements.Count; ++i )\n    {\n      this.RootPanel.Children.Add( layoutPanelElements[ i ] );\n    }\n  }\n\r\n2) Replace the ReadRootPanel method with the following :\r\nprivate ListILayoutPanelElement ReadRootPanel( XmlReader reader, out Orientation orientation )\r\n{\n  orientation = Orientation.Horizontal;\n  var result = new ListILayoutPanelElement();\n\n  var startElementName = reader.LocalName;\n  reader.Read();\n  if( reader.LocalName.Equals( startElementName )  ( reader.NodeType == XmlNodeType.EndElement ) )\n  {\n    return null;\n  }\n\n  while( reader.NodeType == XmlNodeType.Whitespace )\n  {\n    reader.Read();\n  }\n\n  if( reader.LocalName.Equals( RootPanel ) )\n  {\n    orientation = (reader.GetAttribute( Orientation ) == Vertical) ? Orientation.Vertical : Orientation.Horizontal;\n    reader.Read();\n\n    while( true )\n    {\n      //Read all RootPanel children\n      var element = ReadElement( reader ) as ILayoutPanelElement;\n      if( element != null )\n      {\n        result.Add( element );\n      }\n      else if( reader.NodeType == XmlNodeType.EndElement )\n      {\n        break;\n      }\n    }\n  }\n\n  reader.ReadEndElement();\n\n  return result;\n}\r\n"}}
{"actor":{"display_login":"XceedBoucherS"}}