Пример #1
0
 /// <summary>
 ///     Measures the content with a specific size.
 /// </summary>
 /// <param name="desiredSize">The size passed to the content.</param>
 internal void MeasureContent(Size desiredSize)
 {
     if (ContentSite != null)
     {
         ContentSite.Measure(desiredSize);
     }
 }
Пример #2
0
        public override void GenerateSite(HttpListenerContext context, PreparedData callData)
        {
            ContentSite contentData = (ContentSite)callData.Context;

            // write first part
            context.Response.OutputStream.Write(contentData.OwnContent, 0, lengthA);
            // write the inner data
            contentData.Site.GenerateSite(context, contentData.PreparedData);
            // write outer part
            context.Response.OutputStream.Write(contentData.OwnContent, startB, lengthB);
        }
Пример #3
0
        /// <summary>
        ///     Arranges the control and its content. Content is arranged according
        ///     to the TargetSize and clipped.
        /// </summary>
        /// <param name="finalSize">
        ///     The final area within the parent that this
        ///     object should use to arrange itself and its children.
        /// </param>
        /// <returns>The actual size used.</returns>
        protected override Size ArrangeOverride(Size finalSize)
        {
            if (ContentSite == null)
            {
                return(finalSize);
            }

            // arrange content as if filling the targetSize
            Size desiredSize = TargetSize;

            // if a direction is not set, use given size.
            if (desiredSize.Width.Equals(Double.NaN))
            {
                desiredSize.Width = finalSize.Width;
            }
            if (desiredSize.Height.Equals(Double.NaN))
            {
                desiredSize.Height = finalSize.Height;
            }

            var finalRect = new Rect(new Point(0, 0), desiredSize);

            ContentSite.Arrange(finalRect);

            var actualSize = new Size(
                (IsHorizontalRevealMode ? Width : finalSize.Width),
                (IsVerticalRevealMode ? Height : finalSize.Height));

            if (Double.IsNaN(actualSize.Width))
            {
                actualSize.Width = finalSize.Width;
            }
            if (Double.IsNaN(actualSize.Height))
            {
                actualSize.Height = finalSize.Height;
            }

            UpdateClip(actualSize);

            return(actualSize);
        }