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); }
public ShellItemRenderer(IFlyoutController flyoutController, ShellItem item) { _flyoutController = flyoutController; _shellItem = item; _shellItem.PropertyChanged += OnShellItemPropertyChanged; (_shellItem.Items as INotifyCollectionChanged).CollectionChanged += OnShellItemsCollectionChanged; _box = new Native.Box(Forms.NativeParent); _box.LayoutUpdated += OnLayoutUpdated; _box.Show(); CreateToolbar(); CreateMoreToolbar(); ResetToolbarItems(); UpdateCurrentShellSection(_shellItem.CurrentItem); if (_drawer != null) { _currentSection?.StackBelow(_drawer); } ((IShellController)_shellItem.Parent).AddAppearanceObserver(this, _shellItem); }
public ShellItemRenderer(IFlyoutController flyoutController, ShellItem item) { _flyoutController = flyoutController; _shellItem = item; _shellItem.PropertyChanged += OnShellItemPropertyChanged; (_shellItem.Items as INotifyCollectionChanged).CollectionChanged += OnShellItemsCollectionChanged; _box = new Native.Box(Forms.NativeParent); _box.LayoutUpdated += OnLayoutUpdated; _box.Show(); // Create Tabs _tabs = CreateTabs(); _tabs.TargetView.Show(); Control.PackEnd(_tabs as EvasObject); InitializeTabs(); // Create More Tabs _more = CreateMoreToolbar(); _more.Show(); _drawer = CreateDrawer(); _drawer.Show(); Control.PackEnd(_drawer); InitialzeDrawer(_more); ResetToolbarItems(); UpdateCurrentShellSection(_shellItem.CurrentItem); if (_drawer != null) { _currentSection?.StackBelow(_drawer); } ((IShellController)_shellItem.Parent).AddAppearanceObserver(this, _shellItem); }