Skip to content

Impossible to make the Visual Studio PropertyGrid use my custom FileNameEditor derived class #6553

Description

@cadilhac
  • .NET Core Version:
    .Net 6

  • Have you experienced this same bug with .NET Framework?:
    No, it works perfectly with the .Net Framework

Problem description:
I want to use a custom FileNameEditor for a custom control property. I derived from FileNameEditor like so:

public class MyFileNameEditor : System.Windows.Forms.Design.FileNameEditor
{
    protected override void InitializeDialog(OpenFileDialog openFileDialog)
    {
        base.InitializeDialog(openFileDialog);

        openFileDialog.Filter = "My files (*.custom)|*.custom";
    }
}

I applied it like so:

[Editor(typeof(MyFileNameEditor ), typeof(System.Drawing.Design.UITypeEditor))]
public string MyFileName
{
    set [...]
    get [...]
}

In the VS designer, when selecting the custom control, inside the PropertyGrid, the property will have no editor.
Note that if I use the stock FileNameEditor instead, it just works.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions