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

Bind current rating to ViewModel property? #9

Open
dylinmaust opened this issue Jun 7, 2017 · 1 comment
Open

Bind current rating to ViewModel property? #9

dylinmaust opened this issue Jun 7, 2017 · 1 comment

Comments

@dylinmaust
Copy link

Is there any way to expose the current value of the star rating to a property on the View Model?

@dylinmaust
Copy link
Author

My workaround was to add it as a CommandParameter:

<Button Text="Submit" Command="{Binding SubmitSurveyCommand}"
            CommandParameter="{Binding Source={x:Reference starFive},Path=Rating}"/>

And react to it in the ViewModel Command:

public ICommand SubmitSurveyCommand
        {
            get
            {
                return _submitSurveyCommand ?? (_submitSurveyCommand = new Command<int>(async rating => {
                    IsBusy = true;
                    await Task.Delay(50);
                    IsBusy = false;
                }));
            }
        }

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