Пример #1
0
        // optimized arrange for common usage
        private Size ArrangeSingleCell(Size finalSize, IDefinitionBase columnDefinition, IDefinitionBase rowDefinition)
        {
            double finalWidth  = rowDefinition.Length.IsAbsolute ? rowDefinition.Length.Value : finalSize.Width;
            double finalHeight = columnDefinition.Length.IsAbsolute ? columnDefinition.Length.Value : finalSize.Height;

            Rect finalRect = new Rect(finalWidth, finalHeight);

            foreach (FrameworkElement child in Children)
            {
                child.Arrange(finalRect);
            }

            columnDefinition.ActualLength = finalWidth;
            rowDefinition.ActualLength    = finalHeight;

            return(finalSize);
        }
Пример #2
0
 private static double GetStarredAxisLength(IDefinitionBase starredAxis, double starLength)
 {
     return((starredAxis.Length.Value * starLength).Bounds(starredAxis.MinLength, starredAxis.MaxLength));
 }
Пример #3
0
 private static void SetStarLengths(IDefinitionBase[] definitionBases, double starLength, ref double[] lengths)
 {
     for (int i = 0; i < definitionBases.Length; i++)
     {
         if (definitionBases[i].Length.IsStar)
         {
             lengths[i] = definitionBases[i].Length.Value * starLength;
         }
     }
 }
Пример #4
0
 private static void SetBoundedValues(IDefinitionBase[] definitionBases, ref double[] lengths)
 {
     for (int i = 0; i < lengths.Length; i++)
     {
         lengths[i] = lengths[i].Bounds(definitionBases[i].MinLength, definitionBases[i].MaxLength);
     }
 }
Пример #5
0
 private static void SetActualLength(IDefinitionBase[] definitionBases, double[] actualLengths)
 {
     for (int i = 0; i < definitionBases.Length; i++)
     {
         definitionBases[i].ActualLength = actualLengths[i];
     }
 }
Пример #6
0
 private static double GetStarredAxisLength(IDefinitionBase starredAxis, double starLength)
 {
     return (starredAxis.Length.Value * starLength).Bounds(starredAxis.MinLength, starredAxis.MaxLength);
 }
Пример #7
0
        private static double GetMeasureLength(IDefinitionBase[] definitionBases, double availableLength, double start, double span)
        {
            double remainingLength = availableLength;
            double absoluteLength = 0;
            bool allAbsolute = true;

            for (int i = 0; i < definitionBases.Length; i++)
            {
                if (i >= start && i < start + span)
                {
                    if (definitionBases[i].Length.IsAbsolute)
                    {
                        absoluteLength += (double)definitionBases[i].Length.Value;
                    }
                    else
                    {
                        allAbsolute = false;
                    }
                }
                else if (definitionBases[i].Length.IsAbsolute)
                {
                    remainingLength -= (double)definitionBases[i].Length.Value;
                }
            }

            return allAbsolute ? absoluteLength : Math.Max(0, remainingLength);
        }
Пример #8
0
        // optimized arrange for common usage
        private Size ArrangeSingleCell(Size finalSize, IDefinitionBase columnDefinition, IDefinitionBase rowDefinition)
        {
            double finalWidth = rowDefinition.Length.IsAbsolute ? rowDefinition.Length.Value : finalSize.Width;
            double finalHeight = columnDefinition.Length.IsAbsolute ? columnDefinition.Length.Value : finalSize.Height;

            Rect finalRect = new Rect(finalWidth, finalHeight);

            foreach (FrameworkElement child in Children)
            {
                child.Arrange(finalRect);
            }

            columnDefinition.ActualLength = finalWidth;
            rowDefinition.ActualLength = finalHeight;

            return finalSize;
        }