Copy Paste is Disabled in Property Grid
        Posted  
        
            by ofarooq
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by ofarooq
        
        
        
        Published on 2010-02-15T05:25:36Z
        Indexed on 
            2010/03/16
            13:36 UTC
        
        
        Read the original article
        Hit count: 261
        
Hi All,
I have a FileNameEditor inside a property grid, which has a few entries like
Main File : "C:\blah1"
Sec File: "C:\blah2"
and so on.
My problem is that I cannot copy and paste from one property entry to another, and I cannot type in the fields manually as well. Is there a specific property that will enable editing inside the FileNameEditor. Example
public class MyEditor : FileNameEditor
{
    public override bool GetPaintValueSupported(ITypeDescriptorContext context)
    {
        return false;
    }
    public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
    {
        object e = base.EditValue(context, provider, value);
        if ((value as MyFileS) != null)
        {
            (value as MyFilesS).FileName = (String) e;
        }
        return e;
    }
    protected override void InitializeDialog(OpenFileDialog openFileDialog)
    {
        base.InitializeDialog(openFileDialog);
    }
}
Thanks
© Stack Overflow or respective owner