EToolbarItem AddToolbarItem(Page newItem, int index) { EToolbarItem toolbarItem; if (index == 0) { toolbarItem = _toolbar.Prepend(newItem.Title, string.IsNullOrEmpty(newItem.Icon) ? null : ResourcePath.GetPath(newItem.Icon)); } else { toolbarItem = _toolbar.InsertAfter(_toolbarItemList[index - 1], newItem.Title, string.IsNullOrEmpty(newItem.Icon) ? null : ResourcePath.GetPath(newItem.Icon)); } _toolbarItemList.Insert(index, toolbarItem); _itemToItemPage.Add(toolbarItem, newItem); if (Element.BarBackgroundColor != Color.Default) { toolbarItem.SetPartColor("bg", _toolbar.BackgroundColor); } var childContent = Platform.GetOrCreateRenderer(newItem).NativeView; _innerBox.PackEnd(childContent); newItem.PropertyChanged += OnPageTitleChanged; return(toolbarItem); }