1
XLabsプロジェクトのthisコントロールを使用しています。バインディングと選択はうまく動作しますが、このコントロールを何らかのサーベイで使用しています。クライアントがNext
ボタンをクリックして次の質問を表示した後、前の回答(このコントロールのオプション)を選択解除したいと思います。どのようにこれを行うにはどのようなアイデア?Xamarin.FormsのBindableRadioGroupからのオプションの選択解除
<controls:BindableRadioGroup
ItemsSource="{Binding Answers}"
SelectedIndex="{Binding AnswerSelected, Mode=TwoWay}"
Style="{StaticResource radioGroupStyle}" />
ボタンにバインドさコマンド:
public IAsyncCommand NextCommand
{
get
{
return new AwaitableDelegateCommand(async() => await Next(), CanGoToNextQuestion);
}
}
と方法:
private async Task Next()
{
CurrentQuestionIndex++;
AnsweredQuestions.Add(
new QuestionDto
{
QuestionId = CurrentQuestion.QuestionId,
QuestionText = CurrentQuestion.QuestionText,
Answer = Answers.ElementAt(AnswerSelected).Value,
});
// some stuff here
AnswerSelected = -1;
}
private bool CanGoToNextQuestion()
{
return AnswerSelected != -1;
}