Exemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            StackPanelLayout stackPanelLayout = new StackPanelLayout
            {
                Orientation = Orientation.Vertical,
                Children    =
                {
                    new StackPanelLayout
                    {
                        Orientation = Orientation.Horizontal,
                        Children    = { new BoxElement(100, 200), new BoxElement(200, 300) }
                    },
                    new StackPanelLayout
                    {
                        Orientation = Orientation.Horizontal,
                        Children    = { new BoxElement(100, 200), new BoxElement(200, 300) }
                    }
                }
            };

            stackPanelLayout.CalculateLayout(new Size(2000, 2000));

            foreach (LayoutElement layoutElement in stackPanelLayout.GetLeafs())
            {
                Rect bounds = stackPanelLayout.GetDescendantBounds(layoutElement);
            }
        }
Exemplo n.º 2
0
        protected override Size MeasureOverrideCore(Size availableSize)
        {
            _elements.Clear();

            var found = false;

            Offset = 0;

            foreach (RibbonPageCategory pageCategory in Children)
            {
                if (found == false && string.IsNullOrEmpty(pageCategory.Header))
                {
                    Offset += pageCategory.PagesSize.Width;
                    continue;
                }

                found = true;
                _elements.Add(pageCategory);
            }

            return(StackPanelLayout.Measure(this, availableSize));
        }
Exemplo n.º 3
0
 protected override Size MeasureOverrideCore(Size availableSize)
 {
     return(StackPanelLayout.Measure(this, availableSize));
 }
Exemplo n.º 4
0
 protected override Size ArrangeOverrideCore(Size finalSize)
 {
     return(StackPanelLayout.Arrange(this, finalSize));
 }