private Type GetPropertyType (Type objType, string propName)
{
// attached property
int dotPos = propName.IndexOf('.');
if (dotPos != -1)
return GetPropertyType(GetTypeByName(propName.Substring(0, dotPos)), propName.Substring(dotPos + 1));
// simple property
PropertyInfo prop = objType.GetProperty(propName);
if (prop != null)
return prop.PropertyType;
// dependency property
FieldInfo dfield = objType.GetField(propName + KnownStrings.DependencyPropertySuffix,
BindingFlags.Static | BindingFlags.Public);
if (dfield != null) {
var dprop = dfield.GetValue(null) as DependencyProperty;
if (dprop != null)
return dprop.PropertyType;
}
/*throw new InvalidOperationException(String.Format("Property {0} not found in class {1}.",
propName, objType.FullName));*/
return null;
}