This project has moved and is read-only. For the latest updates, please go here.

PropertyGrid overwriting DataContext of custom editor control

Aug 30, 2016 at 11:32 PM
I have a custom Property Grid editor, and the data context of the control is being overwritten, which causes issues with viewmodels, etc.

public class MyCustomEditor : ITypeEditor
    public FrameworkElement ResolveEditor(PropertyItem propertyItem)
        var button = new Button();
        button.DataContext = "example";
        button.DataContextChanged += (sender, args) => {Console.WriteLine("Data context changed!"); };
        return button;
The event will trigger after the Property Grid loads the editor, overwriting the initial data context.

Is this intentional behaviour?
Sep 6, 2016 at 4:19 PM