Ejemplo n.º 1
0
        protected override List <ElementSite> CaptureOrderedSequence(FrameworkElement source)
        {
            var stackPanel      = GetParentStackPanel(source);
            var offset          = 0.0;
            var elementSites    = new List <ElementSite>();
            var orientation     = stackPanel.Orientation;
            var orderedChildren = stackPanel.Children.OfType <FrameworkElement>();

            foreach (var child in orderedChildren)
            {
                var ls          = LayoutInformation.GetLayoutSlot(child);
                var size        = orientation == Orientation.Horizontal ? ls.Width : ls.Height;
                var elementSite = new FrameworkElementSite(child, offset, size, orientation);

                SetElementSite(child, elementSite);

                elementSite.SetDefinitionOffset(offset);
                elementSites.Add(elementSite);
                offset += size;
            }

            return(elementSites);
        }
Ejemplo n.º 2
0
 private static void SetElementSite(DependencyObject element, FrameworkElementSite value)
 {
     element.SetValue(ElementSiteProperty, value);
 }