Ejemplo n.º 1
0
        void OnDropDownContentMustBeClosed(object sender, EventArgs e)
        {
            _ownerPropertyEnum.Property.ParentGrid.BeginUpdate();

            object obj        = _editorContainer.DropDownContent.GetValue();
            int    imageIndex = _editorContainer.SelectedIndex;
//            HideDropDownContent();

            DropDownContentClosedEventArgs ddccea = e as DropDownContentClosedEventArgs;

            if (ddccea.ToBeValidated)
            {
//                object obj = _editorContainer.DropDownContent.GetValue();

                if (obj != null) // obj == null if the list is closed without any selection
                {
                    if (obj is string)
                    {
                        Text = obj as string;
                    }
                    else
                    {
                        string str = _ownerPropertyEnum.Property.Value.TypeConverter.ConvertToString(
                            _ownerPropertyEnum.Property.Value.GetTypeDescriptorContext(_ownerPropertyEnum),
                            _ownerPropertyEnum.Property.Value.CultureInfo, obj);
                        Text = (str == null ? "" : str);
                    }
                    _ownerPropertyEnum.Property.Value.ImageIndex = imageIndex;
//                    _ownerPropertyEnum.Property.Value.ImageIndex = _editorContainer.SelectedIndex;
                    CommitChanges(true);
                }
            }
            else
            {
                _ownerPropertyEnum.Property.Value.ImageIndex = _oldImageListIndex;
                Text = _initialValue;

                CommitChanges(true);
            }

/*
 *          if (ddccea.ReasonLostFocus)
 *          {
 *              _wmFocusMissingArg = ddccea.WndTakingFocus;
 *
 *              // We simulate a LostFocus on this PropInPlaceList
 *              base.OnLostFocus(e);
 *          }
 */
            HideDropDownContent();

            _ownerPropertyEnum.Property.ParentGrid.EndUpdate();
        }
Ejemplo n.º 2
0
        void OnDropDownContentMustBeClosed(object sender, EventArgs e)
        {
            DropDownContentClosedEventArgs ddccea = e as DropDownContentClosedEventArgs;

            if (ddccea.ReasonLostFocus)
            {
                _wmFocusMissingArg = ddccea.WndTakingFocus;
            }

            object obj = _editorContainer.DropDownContent.GetValue();

            if (ddccea.ToBeValidated)
            {
                if (obj is string)
                {
                    ListText = obj.ToString();
                    CommitListChanges();
                    _initialListValue = ListText;
                }
            }

            HideDropDownContent();
        }