c# - How to get the type that a DependencyProperty uses for its value in Silverlight? -
i want check type of dependencyproperty , in wpf following:
dependencyproperty property = ...; var typeasstring = property.propertytype.name;
as propertytype
only available in wpf.
i wondering if there way of achieving in silverlight.
i think might worth you. how dependencyproperty name in silverlight?
you have use reflection:
public static dependencyproperty getdependencyproperty(type type, string name) { fieldinfo fieldinfo = type.getfield(name, bindingflags.public | bindingflags.static); return (fieldinfo != null) ? (dependencyproperty)fieldinfo.getvalue(null) : null; }
as seen in answer usage is:
var dp = getdependencyproperty(typeof(textbox), "textproperty");
hth
Comments
Post a Comment