In order to create a Custom editor with RadGridView by following a guide at: Create Custom Editor with RadGridView
It looks OK, but I would change the DataMemberBinding to Int32 instead of System.Windows.Media.Color, because System.Windows.Media.Color belongs to View class I don't really want to use it in my ViewModel. The converter looks like:
public
object
Convert(
object
value, Type targetType,
object
parameter, System.Globalization.CultureInfo culture)
{
int
num= System.Convert.ToInt32(value);
Color color;
byte
[] bytes = BitConverter.GetBytes(num);
color = Color.FromArgb(bytes[3], bytes[2], bytes[1], bytes[0]);
return
new
SolidColorBrush(color);
}
The converter get correct value for control, but when I change color from CorlorPicker, it get validation error in the cell and it says: Object of type "System.Windows.Media.Color" cannot be converted to type "System.Int32".
Any idea to resolve the problem? Thanks in advance.