void OnContent() { _scrollCanvas.UnPackAll(); if (Element.Content != null) { _scrollCanvas.PackEnd(Platform.GetOrCreateRenderer(Element.Content).NativeView); UpdateContentSize(); } }
EvasObject GetContent(object data, string part) { ShellSection section = data as ShellSection; var box = new Native.Box(Forms.NativeParent); box.Show(); var icon = new Native.Image(Forms.NativeParent) { MinimumWidth = Forms.ConvertToScaledPixel(44), MinimumHeight = Forms.ConvertToScaledPixel(27) }; var task = icon.LoadFromImageSourceAsync(section.Icon); icon.Show(); var title = new Native.Label(Forms.NativeParent) { Text = section.Title, FontSize = Forms.ConvertToEflFontPoint(14), HorizontalTextAlignment = Native.TextAlignment.Start, VerticalTextAlignment = Native.TextAlignment.Center }; title.Show(); box.PackEnd(icon); box.PackEnd(title); box.LayoutUpdated += (object sender, LayoutEventArgs e) => { icon.Move(e.Geometry.X + _iconPadding, e.Geometry.Y + _iconPadding); icon.Resize(_iconSize, _iconSize); title.Move(e.Geometry.X + 2 * _iconPadding + _iconSize, e.Geometry.Y); title.Resize(e.Geometry.Width - (2 * _iconPadding + _iconSize), e.Geometry.Height); }; box.MinimumHeight = _cellHeight; return(box); }
/// <summary> /// Adds a new child to a container. /// </summary> /// <param name="view">Native element which will be added</param> void OnAdd(EvasObject view) { _box.PackEnd(view); }