Let's say you're dynamically getting a list of passengers who can check in on a flight. The user needs to be able to select any number of passengers from the list to check in. I can make the dynamic list, but I can't figure out how to allow it to select multiple options. I've used the .SetAllowsMultiple(true) on the dynamic field but it doesn't work. I've looked at the formflow example in the documentation here but the example only allows for a single selection. How would you make it work with multiple selections?
Here's the property I placed in my CheckinDialog class:
public string Passenger { get; set; }
And here's my dynamic field:
.Field(new FieldReflector<CheckinDialog>(nameof(Passenger))
.SetAllowsMultiple(true)
.SetActive((state) =>
{
return CheckinDialog.Passengers != null && CheckinDialog.Passengers.Count > 0;
})
.SetPrompt(new PromptAttribute(Resources.Checkin.Passengers))
.SetType(null)
.SetDefine((state, field) =>
{
foreach (var pax in GetPassengers())
field
.AddDescription(pax, pax)
.AddTerms(pax, pax);
return TaskHelpers.FromResult(true);
}))