protected virtual void UpdateBackgroundColor() { if (_disposed || Element == null || Control == null) { return; } Container.SetBackgroundColor(Element.BackgroundColor); }
private Task AnimatePageAsync(Container container, int from, int to) { return(new FloatAnimation(from, to, TimeSpan.FromMilliseconds(NavigationAnimationDuration), true, (x) => { GLib.Timeout.Add(0, () => { container?.MoveTo(Convert.ToInt32(x), 0); return false; }); }).Run()); }
protected override void OnSizeAllocated(Gdk.Rectangle allocation) { base.OnSizeAllocated(allocation); double width, height, translationX, translationY; Rectangle bounds = Element.Bounds; translationX = Element.TranslationX; translationY = Element.TranslationY; width = bounds.Width >= -1 ? bounds.Width : 0; height = bounds.Height >= -1 ? bounds.Height : 0; Container.SetSize(width, height); Container.MoveTo((int)bounds.X + translationX, (int)bounds.Y + translationY); for (var i = 0; i < ElementController.LogicalChildren.Count; i++) { var child = ElementController.LogicalChildren[i] as VisualElement; if (child != null) { var renderer = Platform.GetRenderer(child); if (renderer != null) { width = child.Bounds.Width >= -1 ? child.Bounds.Width : 0; height = child.Bounds.Height >= -1 ? child.Bounds.Height : 0; translationX = child.TranslationX; translationY = child.TranslationY; renderer.Container.SetSize(width, height); renderer.Container.MoveTo(child.Bounds.X + translationX, child.Bounds.Y + translationY); } } } }