protected override SizeRequest OnMeasure(double widthConstraint, double heightConstraint) { var contentMeasure = ContentHolder.Measure(widthConstraint, heightConstraint, MeasureFlags.IncludeMargins); var drawerMeasure = DrawerHolder.Measure(widthConstraint, heightConstraint, MeasureFlags.IncludeMargins); return(new SizeRequest(new Size { Width = contentMeasure.Request.Width + DrawerClosedWidth, Height = Math.Max(contentMeasure.Request.Height, drawerMeasure.Request.Height) }, new Size { Width = contentMeasure.Minimum.Width + DrawerClosedWidth, Height = Math.Max(contentMeasure.Minimum.Height, drawerMeasure.Minimum.Height) })); }
protected override void LayoutChildren(double x, double y, double width, double height) { var isRTL = (DrawerPosition == DrawerPosition.Right) || (DrawerPosition == DrawerPosition.Default && (this as IVisualElementController).EffectiveFlowDirection.IsRightToLeft()); var drawerMeasure = DrawerHolder.Measure(width, height); double drawerWidth = DrawerWidth != 0 ? DrawerWidth : drawerMeasure.Request.Width; double drawerWidthOutBound = (drawerWidth - DrawerClosedWidth) * (1 - OpenRatio); double drawerWidthInBound = drawerWidth - drawerWidthOutBound; double startX = isRTL ? (x + width - (drawerWidthInBound)) : (x - drawerWidthOutBound); LayoutChildIntoBoundingRegion(DrawerHolder, new Rectangle(startX, y, drawerWidth, height)); double contentWidth = DrawerMode == DrawerMode.Resize ? width - drawerWidthInBound : width; double contentStartX = isRTL || DrawerMode == DrawerMode.Overlap ? x : (x + drawerWidthInBound); LayoutChildIntoBoundingRegion(ContentHolder, new Rectangle(contentStartX, y, contentWidth, height)); }