Ejemplo n.º 1
0
        /// <summary>
        /// Gets the measured length of layout grid track.
        /// </summary>
        /// <param name="gridTrack">The layout grid track.</param>
        /// <returns>the measured length.</returns>
        public double?GetMeasuredLength(GridTrack gridTrack)
        {
            gridTrack.VerifyNotNull(nameof(gridTrack));
            if (!gridTrack.IsContainer)
            {
                throw new ArgumentException(DiagnosticMessages.RowPresenter_Resize_InvalidGridTrack, nameof(gridTrack));
            }
            if (IsDisposed)
            {
                throw new ObjectDisposedException(GetType().FullName);
            }

            var scrollableManager = ScrollableManager;

            if (scrollableManager == null || Template.FlowRepeatCount != 1)
            {
                throw new InvalidOperationException(DiagnosticMessages.RowPresenter_Resize_NotAllowed);
            }

            var rowView = View;

            if (rowView == null)
            {
                return(null);
            }
            var containerView = scrollableManager[rowView.ContainerOrdinal];

            return(scrollableManager.GetMeasuredLength(containerView, gridTrack));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Resizes the layout grid track.
        /// </summary>
        /// <param name="gridTrack">The layout grid track.</param>
        /// <param name="length">The resized length.</param>
        public void Resize(GridTrack gridTrack, GridLength length)
        {
            gridTrack.VerifyNotNull(nameof(gridTrack));
            if (!gridTrack.IsContainer)
            {
                throw new ArgumentException(DiagnosticMessages.RowPresenter_Resize_InvalidGridTrack, nameof(gridTrack));
            }
            if (length.IsStar)
            {
                throw new ArgumentException(DiagnosticMessages.RowPresenter_Resize_InvalidStarLength, nameof(length));
            }
            if (IsDisposed)
            {
                throw new ObjectDisposedException(GetType().FullName);
            }

            var scrollableManager = ScrollableManager;

            if (scrollableManager == null || Template.FlowRepeatCount != 1)
            {
                throw new InvalidOperationException(DiagnosticMessages.RowPresenter_Resize_NotAllowed);
            }

            scrollableManager.Resize(this, gridTrack, length);
        }