I encountered a strange behaviour in the following scenario:
I have two objects A and B that have different properties (A.BlueProperty, B.RedProperty). These properties require different editors to be represented in the PropertyGrid. The PropertyGrid properties are being initialized in code-behind as follows:
Now, when I select the object A I get the “BindingExpression path error” stating that RedProperty couldn’t be found on object A (as expected, since A has BlueProperty but not RedProperty). So it seems that the PropertyGrid loads all editors at once, in spite of defining explicitly which editor to use for which selectedObject. Moreover, when switching between A and B object selection, the number of warnings increases. So after the click sequence of A-B-A-B-A, I’ll have a total of 6 (1+2+3) “BindingExpression path error” warnings for object A, suggesting again some kind of incremental addition of the editors (accordingly, I’ll also have 3 (1+2) “BindingExpression path error” warnings for not finding BlueProperty for object B).
I just sent you a dummy project that reproduces the issue. However, after deeper inspection I realized that the issue was caused by the incorrect binding, the PropertyGrid had nothing to do with it (in my context the binding mode should have been Mode=”OneTime”).