private void HandleChoicesSet(JArray choices) { Choices.Clear(); foreach (var item in choices.OfType <JObject>()) { var choice = new AdaptiveChoice(); choice.Initialize(item, Renderer); Choices.Add(choice); } if (ComboBox.SelectedIndex != -1) { UpdateInputValue(); } }
public override void ApplyArrayChanges(string propertyName, JArray changes) { switch (propertyName) { case "choices": foreach (var change in changes.OfType <JObject>()) { if (change.Value <string>("type") == "Add") { var choice = new AdaptiveChoice(); choice.Initialize(change.Value <JObject>("item"), Renderer); Choices.Insert(change.Value <int>("index"), choice); } else { Choices.RemoveAt(change.Value <int>("index")); } } break; } }