Skip to content

Instantly share code, notes, and snippets.

@rdelrosario
Created January 25, 2021 20:32
Show Gist options
  • Save rdelrosario/b5b019b6835f1e291e353890b94e8c51 to your computer and use it in GitHub Desktop.
Save rdelrosario/b5b019b6835f1e291e353890b94e8c51 to your computer and use it in GitHub Desktop.
namespace DynamicDataGroupingSample
{
public class MainViewModel : ReactiveObject, IDisposable
{
public MainViewModel()
{
SortCommand = ReactiveCommand.CreateFromTask(ExecuteSort);
}
private async Task ExecuteSort()
{
var sort = await App.Current.MainPage.DisplayActionSheet("Sort by", "Cancel", null, buttons: new string[] { "Name", "Type" });
if (sort != "Cancel")
{
SortBy = sort;
}
}
private string SortBy
{
get => _sortBy;
set => this.RaiseAndSetIfChanged(ref _sortBy, value);
}
public ReactiveCommand<Unit, Unit> SortCommand { get; }
private string _sortBy;
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment