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
|
Hi, I have an object that implements IDataErrorInfo for some properties. When displaying such an object in WPFPropertyGrid I get an TargetParameterCountException: "Parameter count mismatch" with following stack: at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) The IDataErrorInfo implementation provides validate on several properties. Implementation is per: http://msdn.microsoft.com/en-us/library/bb909868.aspx Is there any support for IDataErrorInfo in WPFPropertyGrid? |
|
|
Hi Bill, Yes, IDataErrorInfo is supported in the grid and in the built-in editors. (Note that if you write your own editor then you will need to declare the appropriate validation on the data bindings.) From the stack trace, it looks like the issue is that the grid is incorrectly attempting to use the this[] property defined as part of IDataErrorInfo as a "normal," displayable property (which causes a TargetParameterCountException because IDataErrorInfo.this[] expects to be passed a column name). However I have been unable to reproduce this behaviour in our test environment. There have been some changes in recent nightly builds in the area that the stack trace points at. Could you try again with a current nightly and let me know if you still see the problem? (Trial nightlies from http://www.mindscape.co.nz/Products/WpfPropertyGrid/nightlybuilds.aspx, retail nightlies from the store.) If you do still get the error, could you post the class that implements IDataErrorInfo and exhibits the problem? Thanks! As an alternative you could try making the IDataErrorInfo members an explicit interface implementation. (I generally prefer this myself anyway because I dislike IDataErrorInfo's use of indexer syntax; when I see an indexer on an object, it implies to me that the object itself is a collection, which is not the case with IDataErrorInfo.) I am not sure if this will help because I can't reproduce the failure, but our existing test cases for IDataErrorInfo used an explicit interface implementation, and they have been passing since v1.0, so might be worth a try. |
|