public void CreateActionSheetOptionsFromEnumValue() { var option = ActionSheetViewModel.FromEnum <TestEnum>(); Assert.IsNotNull(option); Assert.AreEqual(3, option.Options.Count()); }
public async void ActionSheet(ActionSheetConfig config) { var vm = new ActionSheetViewModel { Title = config.Title, Message = config.Message, Items = config .Items .Select(x => new ActionSheetItemViewModel { Text = x.Title, Icon = x.Icon, Action = PopAction(x.Action) }) .ToList(), IsCancellable = config.IsCancellable, CancelLabel = config.CancelLabel ?? "Cancel", Cancel = PopAction(() => { }), }; await PopupNavigation.Instance.PushAsync(new ActionSheetPage { BindingContext = vm }); }
public IntegrationViewModel(IActionSheetController actionController, INavigationService navigationService, ISchedulerService scheduler) : base(navigationService, scheduler) { _actionController = actionController; Title = "Toolbar Tester"; _saveCommand = new Command((obj) => { var options = new ActionSheetViewModel() { CancelMessage = "Cancel", DestructionMessage = "Darth!", Title = "Evil?", Options = new [] { new ActionSheetOption() { Title = "A" }, new ActionSheetOption() { Title = "B" }, new ActionSheetOption() { Title = "C" } } }; _actionController.ShowActionSheet(options); }); Toolbar.Add(new TextToolbarItemViewModel("Save", _saveCommand)); var section = AddSection("Balls"); section.AddCell(new TextCellViewModel() { Text = "Tester" }); section.AddCell(new NumericEntryCellViewModel(23.5M) { Label = "Tester" }); }