public override void UpdateData(ScrollViewCell cell) { _dropdownCell = (BaseDropdownCell)cell; _dropdownCell.OnValueChanged = OnValueChanged; _dropdownField = null; foreach (var dropdownField in _presetDropdownFields) { if (dropdownField.TryParse(command, variableInfo, out _options)) { _dropdownField = dropdownField; break; } } if (_dropdownField == null || _options == null || _options.Length == 0) { throw new System.Exception("There is something wrong!"); } // If the field doesn't have value yet, set it to the first element (0) in options int dropdownIndex = _dropdownField.GetDropdownIndex(command, variableInfo, _options); if (dropdownIndex == -1) { _dropdownField.OnValueChanged(command, variableInfo, _options, 0); } _dropdownCell.SetOptions(_options); _dropdownCell.SetIndex(dropdownIndex); }
void OnValueChanged(BaseDropdownCell cell, int index) { _dropdownField.OnValueChanged(command, variableInfo, _options, index); base.OnValueChanged(); }