Unfortunately I'm using an older version of the winforms controls, but just in case someone can help..
I'm validating in the property view, but I can't get an error message to show. I even tried to set Description until I worked out the error message issue, but that doesn't show either. (I have the help panel showing).
I have a delegate doing the property validation, which returns me an error string if invalid. The string is being returned correctly. See below for my code; I've only changed a name or two.
private
void
OnValidating(
object
sender, PropertyValidatingEventArgs e)
{
var item = e.Item
as
PropertyGridItem;
if
(item ==
null
)
return
;
if
(_validateProperty !=
null
)
{
var item = GetViewModelItem(sender);
var error =
""
;
var valid = _validateProperty(item, e.Item.Name, e.NewValue
as
string
,
out
error);
if
(!valid)
{
// TODO: error message not showing
item.ErrorMessage = error;
}
e.Cancel = !valid;
}
}