private async void Action(ContentDialogButton button) { if (button.CloseDialog) { await Navigation.PopModalAsync(); } _task.SetResult(button.Result); }
private void Toolbar_ButtonTapped(object sender, EventArgs e) { try { ContentDialogButton button = (ContentDialogButton)sender; Action(button); } catch (Exception ex) { RaiseOnError(ex); } }
private void CreateContent() { _mainGrid = new Grid { RowDefinitions = { new RowDefinition { Height = new GridLength(2, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(2, GridUnitType.Auto) } }, }; _backButton = _buttons.SingleOrDefault(x => x.IsBack); Toolbar toolbar = new Toolbar(new ObservableCollection <ToolbarButton>(_buttons)); toolbar.ButtonTapped += Toolbar_ButtonTapped; _mainGrid.Children.Add(toolbar, 0, 1); _mainGrid.Children.Add(Content, 0, 0); }
public void AddButton(ContentDialogButton button) { _buttons.Add(button); }