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

Nullable<T> not supported as CommandParameter

description

The RelayCommand<T> object does not support Nullable<T> as generic type.
See the question / answer on StackOverflow and the code snippet that causes the issue.

The problem is that in the Execute method of RelayCommand<T>, the parameter type is compared to generic type T. Because the return value of GetType() of a Nullable<T> returns T, the parameter is converter in the Execute method. This causes the following exception:

System.InvalidCastException: Invalid cast from 'System.Boolean' to 'System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.

comments