wpf - How to enumerate all dependency properties of control? -
i have wpf control. example, textbox. how enumerate dependency properties of control (like xaml editor does)?
public ilist<dependencyproperty> getattachedproperties(dependencyobject obj) { list<dependencyproperty> result = new list<dependencyproperty>(); foreach (propertydescriptor pd in typedescriptor.getproperties(obj, new attribute[] { new propertyfilterattribute(propertyfilteroptions.all) })) { dependencypropertydescriptor dpd = dependencypropertydescriptor.fromproperty(pd); if (dpd != null) { result.add(dpd.dependencyproperty); } } return result; }
found here: http://social.msdn.microsoft.com/forums/en/wpf/thread/580234cb-e870-4af1-9a91-3e3ba118c89c
Comments
Post a Comment