S
Steven
I'm trying to set a custom filter for propertygird's FileNameEditor.
//property
[DisplayName("File Path")]
[Category("Video Settings")]
[Description("The path to the file to be played.")]
[System.ComponentModel.Editor(typeof(MovieFileNameEditor),
typeof(UITypeEditor))]
public string FilePath
{
get { return _FilePath; }
set { _FilePath = value; }
}
//FileNameEditor override
internal class MovieFileNameEditor :
System.Windows.Forms.Design.FileNameEditor
{
protected override void InitializeDialog(OpenFileDialog openFileDialog)
{
base.InitializeDialog(openFileDialog);
openFileDialog.Filter = "Movie Files (*.avi, *.mpeg,
*.mpg)|*.avi;*.mpeg;*.mpg";
openFileDialog.Title = "Select Movie File";
}
}
If I try to override either UITypeEditor or FileNameEditor I get an
unhandled exception:
System.BadImageFormatException: Could not load file or assembly 'MyDLLName,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its
dependencies. The module was expected to contain an assembly manifest.
But if I use the .NET versions it works fine:
[System.ComponentModel.Editor(typeof(System.Windows.Forms.Design.FileNameEditor),
typeof(System.Drawing.Design.UITypeEditor))]
But of course I don't get my filtering.
What's causing the BadImageFormatException when I use my own class?
VS2008/.NET version 3.5/C#
Project: Class Library
Thanks in advance,
Steven
//property
[DisplayName("File Path")]
[Category("Video Settings")]
[Description("The path to the file to be played.")]
[System.ComponentModel.Editor(typeof(MovieFileNameEditor),
typeof(UITypeEditor))]
public string FilePath
{
get { return _FilePath; }
set { _FilePath = value; }
}
//FileNameEditor override
internal class MovieFileNameEditor :
System.Windows.Forms.Design.FileNameEditor
{
protected override void InitializeDialog(OpenFileDialog openFileDialog)
{
base.InitializeDialog(openFileDialog);
openFileDialog.Filter = "Movie Files (*.avi, *.mpeg,
*.mpg)|*.avi;*.mpeg;*.mpg";
openFileDialog.Title = "Select Movie File";
}
}
If I try to override either UITypeEditor or FileNameEditor I get an
unhandled exception:
System.BadImageFormatException: Could not load file or assembly 'MyDLLName,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its
dependencies. The module was expected to contain an assembly manifest.
But if I use the .NET versions it works fine:
[System.ComponentModel.Editor(typeof(System.Windows.Forms.Design.FileNameEditor),
typeof(System.Drawing.Design.UITypeEditor))]
But of course I don't get my filtering.
What's causing the BadImageFormatException when I use my own class?
VS2008/.NET version 3.5/C#
Project: Class Library
Thanks in advance,
Steven