hc:DateTimePicker support for Validation
This commit is contained in:
1 parent
13d9404848
commit
30ed64e5d2
3 files changed
+18
-4
No files matched your search
@@ -156,7 +156,7 @@ namespace HandyControl.Controls
|
||||
var isError = !result.Data;
|
||||
if (isError)
|
||||
{
|
||||
SetCurrentValue(IsErrorProperty, true);
|
||||
SetCurrentValue(IsErrorProperty, ValueBoxes.TrueBox);
|
||||
SetCurrentValue(ErrorStrProperty, result.Message);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -427,9 +427,21 @@ namespace HandyControl.Controls
|
||||
}
|
||||
}
|
||||
|
||||
IsError = !result.Data;
|
||||
ErrorStr = result.Message;
|
||||
return result.Data;
|
||||
var isError = !result.Data;
|
||||
if (isError)
|
||||
{
|
||||
SetCurrentValue(IsErrorProperty, ValueBoxes.TrueBox);
|
||||
SetCurrentValue(ErrorStrProperty, result.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
isError = Validation.GetHasError(this);
|
||||
if (isError)
|
||||
{
|
||||
SetCurrentValue(ErrorStrProperty, Validation.GetErrors(this)[0].ErrorContent);
|
||||
}
|
||||
}
|
||||
return !isError;
|
||||
}
|
||||
|
||||
public override string ToString() => SelectedDateTime?.ToString(DateTimeFormat) ?? string.Empty;
|
||||
|
||||
Reference in new issue
Block a user