Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: PropertyGrid overwriting DataContext of custom editor control

$
0
0
I have a custom Property Grid editor, and the data context of the control is being overwritten, which causes issues with viewmodels, etc.

Example:
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?

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>