| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- /*************************************************************************************
- Extended WPF Toolkit
- Copyright (C) 2007-2013 Xceed Software Inc.
- This program is provided to you under the terms of the Microsoft Public
- License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
- For more features, controls, and fast professional support,
- pick up the Plus Edition at http://xceed.com/wpf_toolkit
- Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
- ***********************************************************************************/
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Collections.ObjectModel;
- using System.Windows.Markup;
- using System.Xml.Serialization;
- namespace Xceed.Wpf.AvalonDock.Layout
- {
- [ContentProperty("Children")]
- [Serializable]
- public class LayoutAnchorGroup : LayoutGroup<LayoutAnchorable>, ILayoutPreviousContainer, ILayoutPaneSerializable
- {
- public LayoutAnchorGroup()
- {
- }
- protected override bool GetVisibility()
- {
- return Children.Count > 0;
- }
- #region PreviousContainer
- [field:NonSerialized]
- private ILayoutContainer _previousContainer = null;
- [XmlIgnore]
- ILayoutContainer ILayoutPreviousContainer.PreviousContainer
- {
- get { return _previousContainer; }
- set
- {
- if (_previousContainer != value)
- {
- _previousContainer = value;
- RaisePropertyChanged("PreviousContainer");
- var paneSerializable = _previousContainer as ILayoutPaneSerializable;
- if (paneSerializable != null &&
- paneSerializable.Id == null)
- paneSerializable.Id = Guid.NewGuid().ToString();
- }
- }
- }
- #endregion
- string _id;
- string ILayoutPaneSerializable.Id
- {
- get
- {
- return _id;
- }
- set
- {
- _id = value;
- }
- }
- string ILayoutPreviousContainer.PreviousContainerId
- {
- get;
- set;
- }
- public override void WriteXml(System.Xml.XmlWriter writer)
- {
- if (_id != null)
- writer.WriteAttributeString("Id", _id);
- if (_previousContainer != null)
- {
- var paneSerializable = _previousContainer as ILayoutPaneSerializable;
- if (paneSerializable != null)
- {
- writer.WriteAttributeString("PreviousContainerId", paneSerializable.Id);
- }
- }
- base.WriteXml(writer);
- }
- public override void ReadXml(System.Xml.XmlReader reader)
- {
- if (reader.MoveToAttribute("Id"))
- _id = reader.Value;
- if (reader.MoveToAttribute("PreviousContainerId"))
- ((ILayoutPreviousContainer)this).PreviousContainerId = reader.Value;
- base.ReadXml(reader);
- }
- }
- }
|