Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing RefreshCommandParameter #26

Closed
bojingo opened this issue Aug 21, 2017 · 0 comments
Closed

Missing RefreshCommandParameter #26

bojingo opened this issue Aug 21, 2017 · 0 comments

Comments

@bojingo
Copy link

bojingo commented Aug 21, 2017

I have a use-case where I have a view model that contains an ICommand for refresh. I bind this to the RefreshCommand of the PullToRefreshLayout. Fine.

However, I also want to use an EventToCommandBehavior to bind the refresh command to the Appearing event. But, on appearing I want the refresh command to pull from cache (if present) and the "pull to refresh" behavior to force a cache refresh. This is because the cached data can be modified from elsewhere in the app, and upon returning to the view we want to see the latest data without forcing the user to "pull to refresh".

Both of these variations were implemented in the ICommand instance, but I'd need to specify whether to support cache to the command instance. The most desirable way would be to do this via a RefreshCommandParameter argument. In the Appearing event I would do:

<commands:EventToCommandBehavior EventName="Appearing" Command="{Binding RefreshCommand}" CommandParameter="{StaticResource FalseValue}" />

and in the PullToRefreshLayout would be like this:

<pullToRefresh:PullToRefreshLayout RefreshCommand="{Binding RefreshCommand}" RefreshCommandParameter="{StaticResource TrueValue}" IsPullToRefreshEnabled="True" IsRefreshing="{Binding IsBusy}">
  ...
</pullToRefresh:PullToRefreshLayout>

The trouble is, there is no RefreshCommandParameter.

Instead, my view model is forced to have 2 different ICommand properties, one for the Appearing event's EventToCommandBehavior.Command and another for the PullToRefreshLayout.RefreshCommand.

Please add a RefreshCommandParameter in order to have consistency with other controls that support commands.

P.S. While at it, it would be really nice if this was added to the out of the box ListView. That is a topic for somewhere else, but I'd be nice for this plugin not to make the same mistake in omitting it... https://forums.xamarin.com/discussion/37899/listview-pulltorefresh-doesnt-have-refreshcommandparameter-how-i-got-around-it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant