Ejemplo n.º 1
0
        /// <summary>
        /// Invoked by the <see cref="Primitives.PinnedDocumentsPanel"/> to unpin a child.
        /// </summary>
        /// <param name="documentPaneItem">The <see cref="DocumentPaneItem"/> being unpinned.</param>
        internal void InsertChild(DocumentPaneItem documentPaneItem)
        {
            if (documentPaneItem == null)
            {
                throw new ArgumentNullException("documentPaneItem");
            }

            // since we're virtualizing the scrolling region,
            // we first check if we need to virtualize.

            // TODO: initil implementation, needs improvements on where to insert the just-unpinned document
            this.AddInternalChild(documentPaneItem);
        }
Ejemplo n.º 2
0
        internal void PinChild(DocumentPaneItem documentPaneItem)
        {
            var pinnedDcoumentsPanel = this.PinnedDocumentsPanel;

            if (pinnedDcoumentsPanel == null)
            {
                return;
            }

            this.InternalChildren.RemoveNoVerify(documentPaneItem);
            pinnedDcoumentsPanel.Children.Add(documentPaneItem);

            this.InvalidateMeasure();
            pinnedDcoumentsPanel.InvalidateMeasure();
        }
Ejemplo n.º 3
0
        internal void UnpinChild(DocumentPaneItem documentPaneItem)
        {
            if (documentPaneItem == null)
            {
                throw new ArgumentNullException("documentPaneItem");
            }

            //TODO: what should we do in case the items panel is missing from the template.
            var documentsPanel = this.DocumentsPanel;

            if (documentsPanel == null)
            {
                return;
            }

            this.Children.Remove(documentPaneItem);
            documentsPanel.InsertChild(documentPaneItem);
        }
Ejemplo n.º 4
0
        private void CalculateWrapWidth(double availableWidth, out double wrapWidth)
        {
            // the PinnedDocumentsPanel should at least leave room for a single unpinned item
            // either selected or not, as well as the scroll bar buttons.
            var documentsPanel            = this.DocumentsPanel;
            DocumentPaneItem pivotalChild = null;

            if (documentsPanel != null && documentsPanel.Children.Count > 0)
            {
                pivotalChild = documentsPanel.Children[0] as DocumentPaneItem;
            }

            if (pivotalChild != null)
            {
                pivotalChild.Measure(new Size(availableWidth, Double.PositiveInfinity));
                wrapWidth = Math.Max(0.0, availableWidth - (pivotalChild.DesiredSize.Width + (this.ScrollButtonWidth * 2)));
            }
            else
            {
                wrapWidth = availableWidth;
            }
        }