标签:+= name text system 重写 .text measure gen space
MyPanel.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.Foundation; using Windows.UI.Xaml.Controls; namespace App1 { public class MyPanel : Panel { protected override Size MeasureOverride(Size availableSize) { if (Children.Count > 0) { double yy = 0d; double ww = 0d; foreach (var u in Children) { u.Measure(availableSize); Size dssize = u.DesiredSize; yy += dssize.Height; ww = dssize.Width > ww ? dssize.Width : ww; } return new Size(ww, yy); } return availableSize; } protected override Size ArrangeOverride(Size finalSize) { double y = 0d; foreach (var u in Children) { u.Arrange(new Rect(0d, y, u.DesiredSize.Width, u.DesiredSize.Height)); y += u.DesiredSize.Height; } return finalSize; } } }
标签:+= name text system 重写 .text measure gen space
原文地址:https://www.cnblogs.com/maoriaty/p/9065247.html