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 hit an interesting situation with the property grid where most enum typed properties are displayed using the ListSelect editor but one was displayed with the ListSelectNoTextEntry editor. Can you tell me about the criteria that's used to select the list w/ text editor vs the list w/out text editor? Additionally, is there a way for me in XAML to specify an enum as a type in a TypeEditor, so I can forcibly map all enums to the ListSelectNoTextEntry editor? Thanks, -Craig |
|
|
ListSelect is used for properties whose static type is boolean or enum, where no overriding TypeConverter is specified on the property. ListSelectNoTextEntry is used for all other properties where the property declaration, or the property type or runtime time, specifies a TypeConverterAttribute, and the TypeConverter returns true from GetStandardValuesSupported. To force enums to use the no-text-entry template, since TypeEditor checks for assignability rather than exact type equality, and all enum types derive implicitly from System.Enum, you can use the following: <ms:TypeEditor EditedType="{x:Type s:Enum}" where xmlns:s="clr-namespace:System;assembly=mscorlib". Note you will need to do booleans separately if you want the same behaviour for them. |
|
|
The above works great except for one problem. My EditorTemplate points to ListSelectNoTextEntryEditorKey but I've also changed the ListSelectNoTextEntry style: <ms: BuiltInEditorStyle EditorKey="{x:Static ms:PropertyGrid.ListSelectNoTextEntryEditorKey}"> <Style><Style.Triggers> ... </Style.Triggers> </Style> </ms:BuiltInEditorStyle> So, when the dropdown displays, it appears as the original dropdown, not the one with my style changes. From what I can tell, EditorTemplate expects a DataTemplate as opposed to a style. Is there some generic template I can create, and associate with my changed BuiltInEditorStyle, for the TypeEditor to work with my style changes? Thanks again, -Craig |
|
|
I just ran across http://www.mindscape.co.nz/forums/Thread.aspx?ThreadID=1173 so I think I understand what needs to be done. Thanks, -Craig |
|