I want to implement a custom FileNameEditor; I want to set my own filter and I want to be able to select multiple files.
public class Settings
{
[EditorAttribute(typeof(FileNamesEditor), typeof(System.Drawing.Design.UITypeEditor))]
public string FileNames { get; set; }
}
public class FileNamesEditor : FileNameEditor
{
protected override void InitializeDialog(OpenFileDialog openFileDialog)
{
openFileDialog.Multiselect = true;
openFileDialog.Filter = "Word|*.docx|All|*.*";
base.InitializeDialog(openFileDialog);
}
}
This ignores the filter property and although I am able to select multiple files I can't assign them to my Settings.FileNames property because Settings.FileNames is of type string[] and the result of the derived class is string. How can I tell my derived class to return the openFileDialog's FileNames and how to make the filter work? What am I missing?
Okay, this is how it works...