public void Build(ToolBarItem item) { var btn = new CustomButton { Padding = new Thickness(0, 0, 0, 0), HorizontalOptions = item.Float == Float.Left ? LayoutOptions.Start : LayoutOptions.End, Style = (Style)Application.Current.Resources["ButtonContainer"], TextColor = (Color)Application.Current.Resources["text"], WidthRequest = item.Width, HeightRequest = this.Height }; if (!string.IsNullOrWhiteSpace(item.Text)) { btn.Text = item.Text; btn.Padding = new Thickness(1, 0, 1, 0); btn.FontSize = 12; btn.TextAlignment = TextAlignment.Start; } else { btn.FontSize = 0; } if (item.Icon != null) { btn.ImageSource = item.Icon; } if (ItemClicked != null) { btn.Clicked += new EventHandler((sender, e) => ItemClicked.Invoke(item, btn)); } this.Children.Add(btn); }
private void Toolbar_ItemClicked(Controls.ToolBarItem arg1, Controls.CustomButton arg2) { switch (arg1.Identifier) { case "DownloadCoin": new BuyCoins().Open(); break; } }