private MethodInfo ResolveAttachedPropertyGetter (string base_name, Type type)
{
Type [] arg_types = new Type [] { typeof (DependencyObject) };
string full_name = String.Concat ("Get", base_name);
MethodInfo [] methods = type.GetMethods (XamlParser.METHOD_BINDING_FLAGS);
foreach (MethodInfo method in methods) {
if (method.Name != full_name)
continue;
ParameterInfo [] the_params = method.GetParameters ();
if (the_params.Length != arg_types.Length)
continue;
bool match = true;
for (int i = 0; i < arg_types.Length; i++) {
if (!arg_types [i].IsAssignableFrom (the_params [i].ParameterType)) {
match = false;
break;
}
}
if (match)
return method;
}
return null;
}