This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I have a simple object of type
public class MyData
{
public bool PropertyA { get; set; }
}
that added to a property grid:
When an any build-in style is applied (, Alloy, Blue, Green), the combobox is used for editing value instead of check box.
How PropertyGrid determine, that ListSelectEditorKey should be used for property or RadioSelectEditorKey or ColorEditorKey or any other?
|
|
|
Ivan,
Can you describe the algorithm (in details), that used by PropertyGrid for choosing an editor for property?
|
|
|
The ListSelectEditorKey is used for boolean properties because that is the behaviour of the WinForms grid (and we think it looks a bit better than the check box because of layout and bordering). You can override this by specifying a PropertyEditor and specifying the CheckBoxEditorKey. See the Editors sample for examples. To specify that all booleans should use the CheckBoxEditorKey, use a TypeEditor. The fallback algorithm for deciding which editor to use is part of the BuiltInEditor class and basically chooses the ReadOnly editor for read-only properties, the colour and date pickers for those types, ListSelect for enumerable types and plain text for everything else. This cannot be hooked into as it is the ultimate backstop when no other editor is specified. However, your own editor declarations take precedence so you can use TypeEditors, PropertyEditors or custom editors to customise editor selection as required. |
|