我正在尝试获取参与者列表并在微调器中显示参与者名称。
参与者对象:
public class Participant
{
public int UserId { get; set; }
public string Name { get; set; }
}
视图模型:
private List _participantFilterList = null;
public List ParticipantFilterList
{
get { return _participantFilterList; }
set {
_participantFilterList = value;
RaisePropertyChanged(() => ParticipantFilterList);
}
}
private Participant _selectedParticipantFilter = null;
public Participant SelectedParticipantFilter
{
get { return _selectedParticipantFilter; }
set {
_selectedParticipantFilter = value;
RaisePropertyChanged(() => SelectedParticipantFilter);
}
}
查看:
var respondentSelect = fragView.FindViewById(Resource.Id.respondentSelect);
...
set.Bind(respondentSelect).For(x => x.ItemsSource).To(vm => vm.ParticipantFilterList);
set.Bind(respondentSelect).For(x => x.SelectedItem).To(vm => vm.SelectedParticipantFilter);
我需要它来向我显示参与者名称,但我不确定我缺少这样做。
答案 0 :(得分:4)
您需要在axml布局文件中添加类似MvxItemTemplate="@layout/ParticipantItemTemplate"
的声明,您可以在其中绑定实际的微调器。另外,请确保将您的微调器声明为MvxSpinner
视图。