本文整理匯總了C#中System.Property.ConvertFromBindableValue方法的典型用法代碼示例。如果您正苦於以下問題:C# Property.ConvertFromBindableValue方法的具體用法?C# Property.ConvertFromBindableValue怎麽用?C# Property.ConvertFromBindableValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Property
的用法示例。
在下文中一共展示了Property.ConvertFromBindableValue方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ValidateCore
protected override void ValidateCore(Property property, string value, IList<ValidationResult> results)
{
var elementProperty = property as ElementProperty;
if (elementProperty == null) return;
var lowerBoundTypeProperty = elementProperty.DeclaringElement.Properties.Single(p => p.PropertyName == "LowerBoundType");
var upperBoundTypeProperty = elementProperty.DeclaringElement.Properties.Single(p => p.PropertyName == "UpperBoundType");
if (((RangeBoundaryType)lowerBoundTypeProperty.Value) == RangeBoundaryType.Ignore ||
((RangeBoundaryType)upperBoundTypeProperty.Value) == RangeBoundaryType.Ignore)
{
return;
}
IComparable senderBound = (IComparable)property.ConvertFromBindableValue(value);
IComparable boundToCheck = GetOtherBoundary(elementProperty);
bool isInvalid;
if (property.PropertyName == "UpperBound")
{
isInvalid = CheckBounds(senderBound, boundToCheck);
}
else
{
isInvalid = CheckBounds(boundToCheck, senderBound);
}
if (isInvalid)
{
results.Add(new PropertyValidationResult(property, string.Format(CultureInfo.CurrentCulture, Resources.RangeBoundValidatorErrorMessage)));
}
}
示例2: ValidateCore
protected override void ValidateCore(Property property, string value, IList<ValidationResult> results)
{
var internalValue = (string)property.ConvertFromBindableValue(value);
if (string.IsNullOrEmpty(internalValue))
{
results.Add(new PropertyValidationResult(property, Resources.DatabaseSettingsDoesntHaveDefaultDatabase, true));
}
}