internal void CheckValueType(RenderContext context, TypeCheckerTypeCode typeCode) { var valBind = GetBinding(nameof(Value)); if (valBind != null) { valBind.GetTypedPath(context, typeCode); } }
String TypeCodeToString(TypeCheckerTypeCode code) { switch (code) { case TypeCheckerTypeCode.Boolean: case TypeCheckerTypeCode.String: return(code.ToString().ToLowerInvariant()); default: return(code.ToString()); } }
public void CheckTypedXamlExpression(String expression, TypeCheckerTypeCode typeCode) { var type = CalcExpression(expression)?.Type; if (type == null) { return; } var codeString = TypeCodeToString(typeCode); if (type.TypeName != codeString) { throw new TypeCheckerException($"Xaml. Path='{expression}'. Incompatible types. Expected:'{codeString}', Actual:'{type.TypeName}'"); } }
internal String GetTypedNormalizedPath(String path, TypeCheckerTypeCode typeCode, Boolean isWrapped = false) { // check for invert if (path == null) { path = String.Empty; } if (path.StartsWith("!")) { return("!" + GetNormalizedPathInternal(path.Substring(1))); } if (_typeChecker != null && typeCode != TypeCheckerTypeCode.Skip) { _typeChecker.CheckTypedXamlExpression(GetExpressionForChecker(path), typeCode); } return(GetNormalizedPathInternal(path, isWrapped)); }
public String GetTypedPath(RenderContext context, TypeCheckerTypeCode typeCode) { return(context.GetTypedNormalizedPath(Path, typeCode)); }