Windows Develop Bookmark and Share   
 index > Windows Forms Designer > UITypeEditor Problems
 

UITypeEditor Problems

Sorry if this is the wrong group. I couldn't find anything that was closer....

I'm trying to create a UITypeEditor.  I really want to be able to create a drop down editor, the problem is that when I set GetEditStyle = UITypeEditorEditStyle.DropDown I don't get any drop down displayed so it never drops down my control.

When I set it to modal and handle the EditValue function that my value doesn't cause the Form Designer to recognize a change has occured with a * beside it to save the changes, and clicking on the edit button again, doesn't have my changes.

I've copied the sample from the help almost exactly and still no go. Here's how I've got it implimented:

On the Collection that the UITypeEditor is used for:

       

[System.ComponentModel.DesignerSerializationVisibility(DesignerSerializationVisibility.Content), NotifyParentProperty(true), Editor(typeof(ColumnEditor), typeof(System.Drawing.Design.UITypeEditor))]
        public List<ListColumn> Columns {
            get {
                return pColumns;
            }
        }


 


And Here's my EditValue on the TypeEditor:

public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) {
    if (context == null || context.Instance == null || provider == null || value.GetType() != typeof(List)) return value;
    IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

    if (edSvc != null) {
        frmEditColumns frm = new frmEditColumns(context.Instance, (List) value);
        if (edSvc.ShowDialog(frm) == DialogResult.OK) {
            value = frm.GetColumns();
        }
    }
    return value;
}

 


What am I doing wrong? First why doesn't the DropDown GetEditStyle cause a down arrow to show and second why doesn't the Modal version actually change the Collection?

Also, I notice that if I custom draw with the PaintValue that the Bounds returned is a very small rectangle on the left of the property's value, not the entire area... I figured it should be the entire area??? (I've tured it off and still the drop down doesn't show)

Thanks!
JohnGalt  Tuesday, May 17, 2005 4:01 PM
Have a look at the CollectionEditor base class, and look at overridding CreateCollectionForm.
David M. Kean  Tuesday, May 17, 2005 6:26 PM
Have a look at the CollectionEditor base class, and look at overridding CreateCollectionForm.
David M. Kean  Tuesday, May 17, 2005 6:26 PM
Thanks! That works great! Why doesn't UITypeEditor not work the same???
JohnGalt  Saturday, May 21, 2005 8:11 PM

You can use google to search for other answers

Custom Search

More Threads

• Generating dynamic columns on a designer generated DataGridView control
• hot to turn on ShowFocusCues
• BindingNavigator disappears from Container UserControl at Design Time
• Form designer & setting visibility
• Design time behavior - what do you prefer?
• How to use Internal UserControl
• Strange Problem in Windows form
• Clicking an invisble button
• How to retrieve a specific treeview node?
• Why can't I change a simple name