Beispiel #1
0
        protected override void OnDropDownOpened(EventArgs e)
        {
            base.OnDropDownOpened(e);

            DropDownForm.UpdatePerferedSize(Size);

            var    expression   = Expression;
            object selectedItem = null;

            foreach (var item in _listBox.Items)
            {
                var valueItem = item as ScriptValueList.ValueItem;
                if (valueItem == null)
                {
                    continue;
                }
                var itemExpression =
                    ScriptValueHelper.TextToObject(valueItem.Text, typeof(ScriptStringValue), valueItem.IsExpression).ToString();
                if (expression == itemExpression)
                {
                    selectedItem = item;
                    break;
                }
            }
            _listBox.SelectedItem = selectedItem;
        }
Beispiel #2
0
        private void UpdateDropDown()
        {
            DropDownForm.Items.Clear();
            foreach (object v in _enumValues)
            {
                DropDownForm.Items.Add(new DropDownListBox.Item(v.ToString(), v));
            }

            DropDownForm.UpdatePerferedSize(Size);
        }