/// <summary>
        /// Restore content specific layout settings
        /// </summary>
        /// <param name="storeReader">Saved xml element containg content layout settings</param>
        /// <remarks>Custom derived class must overload this method to restore custom layout settings previously saved trought <see cref="SaveLayout"/>.</remarks>
        public virtual void RestoreLayout(XmlElement contentElement)
        {
            if (contentElement.HasAttribute("FloatingWindowSize"))
            {
                FloatingWindowSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("FloatingWindowSize"));
            }


            Size effectiveSize = new Size(0d, 0d);

            if (contentElement.HasAttribute("EffectiveSize"))
            {
                // Store
                effectiveSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("EffectiveSize"));
            }

            ResizingPanel.SetEffectiveSize(this, effectiveSize);

            if (contentElement.HasAttribute("ChildIndex"))
            {
                _savedStateAndPosition = new DockableContentStateAndPosition(
                    ContainerPane,
                    int.Parse(contentElement.GetAttribute("ChildIndex")),
                    double.Parse(contentElement.GetAttribute("Width")),
                    double.Parse(contentElement.GetAttribute("Height")),
                    (AnchorStyle)Enum.Parse(typeof(AnchorStyle), contentElement.GetAttribute("Anchor"))
                    );
                //contentElement.HasAttribute("State") ? (DockableContentState)Enum.Parse(typeof(DockableContentState), contentElement.GetAttribute("State") );
            }
        }
Esempio n. 2
0
        public override Pane ClonePane()
        {
            DockablePane paneToAnchor = new DockablePane();

            ResizingPanel.SetEffectiveSize(paneToAnchor, new Size(Width, Height));

            if (HostedPane.Style != null)
            {
                paneToAnchor.Style = HostedPane.Style;
            }

            int selectedIndex = HostedPane.SelectedIndex;

            //transfer contents from hosted pane in the floating window and
            //the new created dockable pane
            while (HostedPane.Items.Count > 0)
            {
                paneToAnchor.Items.Add(
                    HostedPane.RemoveContent(0));
            }

            paneToAnchor.SelectedIndex = selectedIndex;

            return(paneToAnchor);
        }
        public override Pane ClonePane()
        {
            DockablePane paneToAnchor = new DockablePane();

            //transfer the resizing panel sizes
            //paneToAnchor.SetValue(ResizingPanel.ResizeWidthProperty,
            //    HostedPane.GetValue(ResizingPanel.ResizeWidthProperty));
            //paneToAnchor.SetValue(ResizingPanel.ResizeHeightProperty,
            //    HostedPane.GetValue(ResizingPanel.ResizeHeightProperty));
            ResizingPanel.SetEffectiveSize(paneToAnchor, new Size(Width, Height));


            int selectedIndex = HostedPane.SelectedIndex;

            //transfer contents from hosted pane in the floating window and
            //the new created dockable pane
            while (HostedPane.Items.Count > 0)
            {
                paneToAnchor.Items.Add(
                    HostedPane.RemoveContent(0));
            }

            paneToAnchor.SelectedIndex = selectedIndex;

            return(paneToAnchor);
        }
Esempio n. 4
0
        /// <summary>
        /// Restore content specific layout settings
        /// </summary>
        /// <param name="storeReader">Saved xml element containg content layout settings</param>
        /// <remarks>Custom derived class must overload this method to restore custom layout settings previously saved trought <see cref="SaveLayout"/>.</remarks>
        public override void RestoreLayout(XmlElement contentElement)
        {
            if (contentElement.HasAttribute("FloatingWindowSize"))
            {
                FloatingWindowSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("FloatingWindowSize"));
            }
            if (contentElement.HasAttribute("FlyoutWindowSize"))
            {
                FlyoutWindowSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("FlyoutWindowSize"));
            }

            Size effectiveSize = new Size(0d, 0d);

            if (contentElement.HasAttribute("EffectiveSize"))
            {
                // Store
                effectiveSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("EffectiveSize"));
            }

            ResizingPanel.SetEffectiveSize(this, effectiveSize);

            if (contentElement.HasAttribute("ChildIndex"))
            {
                Pane paneRef           = null;
                Guid containerPaneGuid = Guid.Empty;
                if (contentElement.HasAttribute("ContainerPaneID"))
                {
                    containerPaneGuid = new Guid(contentElement.GetAttribute("ContainerPaneID"));

                    if (Manager != null)
                    {
                        ILinqToTree <AvaloniaObject> itemFound = new LogicalTreeAdapter(Manager).Descendants().FirstOrDefault(el => el.Item is DockablePane && ((el.Item as DockablePane).ID == containerPaneGuid));
                        paneRef = itemFound != null ? itemFound.Item as DockablePane : null;
                    }
                }

                if (paneRef != null)
                {
                    _savedStateAndPosition = new DockableContentStateAndPosition(
                        paneRef,
                        int.Parse(contentElement.GetAttribute("ChildIndex")),
                        double.Parse(contentElement.GetAttribute("Width")),
                        double.Parse(contentElement.GetAttribute("Height")),
                        (AnchorStyle)Enum.Parse(typeof(AnchorStyle), contentElement.GetAttribute("Anchor")),
                        (DockableContentState)Enum.Parse(typeof(DockableContentState), contentElement.GetAttribute("State")));
                }
                else
                {
                    _savedStateAndPosition = new DockableContentStateAndPosition(
                        containerPaneGuid,
                        int.Parse(contentElement.GetAttribute("ChildIndex")),
                        double.Parse(contentElement.GetAttribute("Width")),
                        double.Parse(contentElement.GetAttribute("Height")),
                        (AnchorStyle)Enum.Parse(typeof(AnchorStyle), contentElement.GetAttribute("Anchor")),
                        (DockableContentState)Enum.Parse(typeof(DockableContentState), contentElement.GetAttribute("State")));
                }
            }
        }
Esempio n. 5
0
        void FloatingWindow_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            if (HostedPane != null)
            {
                foreach (ManagedContent c in HostedPane.Items)
                {
                    c.FloatingWindowSize = new Size(Width, Height);
                }

                ResizingPanel.SetEffectiveSize(HostedPane, new Size(Width, Height));
            }
        }
        public override Pane ClonePane()
        {
            DocumentPane paneToAnchor = new DocumentPane();

            ResizingPanel.SetEffectiveSize(paneToAnchor, new Size(Width, Height));

            //transfer contents from hosted pane in the floating window and
            //the new created dockable pane
            while (HostedPane.Items.Count > 0)
            {
                paneToAnchor.Items.Add(
                    HostedPane.RemoveContent(0));
            }
            paneToAnchor.ApplyTemplate();

            return(paneToAnchor);
        }