AGS.Types.StringListUIEditorControl.Begin C# (CSharp) Method

Begin() public method

public Begin ( IWindowsFormsEditorService service, string value, IList valueList ) : void
service IWindowsFormsEditorService
value string
valueList IList
return void
        public void Begin(IWindowsFormsEditorService service, string value, IList<string> valueList)
        {
            _service = service;
            _value = value;
            clbItems.Items.Clear();
            List<string> selectedValues = new List<string>(value.Split(StringListUIEditor.Separators, StringSplitOptions.RemoveEmptyEntries));
            foreach (string s in valueList)
            {
                clbItems.Items.Add(s, selectedValues.Contains(s));
            }
        }

Usage Example

Beispiel #1
0
 protected string EditValueHelper(ITypeDescriptorContext context, IServiceProvider provider,
                                  string value, IList <string> valueList)
 {
     if ((value == null) || (valueList == null))
     {
         throw new ArgumentNullException();
     }
     if (provider != null)
     {
         IWindowsFormsEditorService editorService = provider.GetService(typeof(IWindowsFormsEditorService))
                                                    as IWindowsFormsEditorService;
         if (editorService == null)
         {
             return(value);
         }
         // prepare list
         editor.Begin(editorService, value, valueList);
         // show drop-down now
         editorService.DropDownControl(editor);
         // now we take the result
         value = editor.Value;
         // reset editor
         editor.End();
     }
     return(value);
 }