This project has moved. For the latest updates, please go here.

Create default editor For TargetType List<T>

Oct 2, 2012 at 4:37 PM
Edited Oct 2, 2012 at 4:40 PM

I want to create a an Editor for the Target Type List<T>. (some Collection)

The thing is that T is different from List to List,  and it cant recognize that its a list.

this the xaml code?


 <xctk:PropertyGrid Name="propertyGridView" Grid.Row="1" Grid.Column="1" MinWidth="220" Margin="0,7,7,9" MinHeight="400">
                <xctk:EditorDefinition >
                            <Button Name="AssigmentButton" Content="Collection" Click="AssigmentButton_Click" DataContext="{Binding Value}" />


and then I initialize it with that

propertyGridView.EditorDefinitions[0].TargetType = typeof(List<>);

How can I make a default editor for a collection List<T>?

Oct 2, 2012 at 6:22 PM

Can you just specify that the target type is "IList" ?

Assigning the TargetType once the EditorDefinition is in the collection will probably not work.

try somthing like:

EditorDefinition editorDef = new EditorDefinition();

editorDef.TargetType = typeof(IList);

editorDef.EditorTemplate = (DataType)this.Resources["myDataTemplate"];


Oct 10, 2012 at 11:07 AM
Edited Oct 10, 2012 at 11:13 AM

Hey emartin,

typeof(IList), wont work either .

if for example I Have a

public class Store
        [Editor(typeof(AssignmentButton), typeof(AssignmentButton))]
        List<Employee> employees { get; set; }

in order for

editorDef.TargetType = typeof(IList); 

to work , I have to define the collection as IList and not as a List.