示例#1
0
        protected override Size ArrangeOverride(Size finalSize)
        {
            Action<UIElement> arrange = delegate(UIElement child)
            {
                TransformGroup tg = (TransformGroup)child.RenderTransform;
                ScaleTransform st = (ScaleTransform)tg.Children[0];
                TranslateTransform tt = (TranslateTransform)tg.Children[3];

                Size childSize = child.DesiredSize;

                child.Arrange(new Rect(childSize));

                tt.SetToVector(finalSize.CenterVector() - childSize.CenterVector());

                double scale = GeoHelper.ScaleToFit(finalSize, childSize);

                st.ScaleX = scale;
                st.ScaleY = scale;
            };

            m_elements.ForEach(arrange);
            m_fadingElements.ForEach(arrange);

            return finalSize;
        }