-
October 5th, 2009, 05:34 PM
#1
My EditorAttribute is ignored
Hello,
I've got a weird problem with my code. I've created an UITypeEditor:
Code:
public class ColorPickerEditor : UITypeEditor {...}
and use it properly:
Code:
[Editor(typeof(TypeEditor.ColorPickerEditor), typeof(System.Drawing.Design.UITypeEditor))]
public System.Drawing.Color TestColorDrawing { get; set; }
[Editor(typeof(TypeEditor.ColorPickerEditor), typeof(System.Drawing.Design.UITypeEditor))]
public Vector4 TestColorV4D { get; set; }
The Editor for the Vector4 works perfectly. The problem is for the other one. If I put a breakpoint in my class, my ColorPickerEditor is never called(instanciated) for the System.Drawing.Color. It seems that the default ColorConverter is used instead of my override.
Anyone has a workaround or ideas?
-
October 6th, 2009, 07:53 AM
#2
Re: My EditorAttribute is ignored
I would try this:
Code:
[Editor(typeof(TypeEditor.ColorPickerEditor), typeof(System.Drawing.Design.ColorEditor))]
public System.Drawing.Color TestColorDrawing { get; set; }
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post.
-
October 6th, 2009, 08:29 AM
#3
Re: My EditorAttribute is ignored
ColorEditor doesn't exist. I've did some seach, but it seems that only TypeConverter exist for the type Color. And if we read the doc about the ctor of the EditorAttribute:
Originally Posted by msdn
Summary:
Initializes a new instance of the System.ComponentModel.EditorAttribute class with the type and the base type.
Parameters:
type: A System.Type that represents the type of the editor.
baseType: The System.Type of the base class or interface to use as a lookup key for the editor. This class must be or derive from System.Drawing.Design.UITypeEditor.
we cannot put a TypeConverter as the second parameter.
-
October 7th, 2009, 02:22 AM
#4
Re: My EditorAttribute is ignored
It is strange. The class exists. But I've not try it.
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post.
-
October 7th, 2009, 08:02 AM
#5
Re: My EditorAttribute is ignored
Looks like I made a mistake with my search, and I didn't have the reference "System.Drawing.Design". But after trying your idea, it doesn't change anything to the problem. I've also tried to inherit from it, but same conclusion.
-
October 8th, 2009, 01:58 AM
#6
Re: My EditorAttribute is ignored
Sorry, I've no futher advice at this time
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|