dependencyobject

DependencyProperty from string

痴心易碎 提交于 2019-11-28 09:12:26
How do I convert a property name (in string) to a DependencyProperty ? I have a set of property names, its values in string and a DependencyObject . Now I want to set these property values to the DependencyObject . Any idea on how this can be achieved? Thanks. You can get DependencyPropertyDescriptor using DependencyPropertyDescriptor.FromName method and then get dependency property identifier from this descriptor. var descriptor = DependencyPropertyDescriptor.FromName( propertyName, dependencyObject.GetType(), dependencyObject.GetType()); // now you can set property value with descriptor

DependencyProperty from string

对着背影说爱祢 提交于 2019-11-27 02:42:34
问题 How do I convert a property name (in string) to a DependencyProperty ? I have a set of property names, its values in string and a DependencyObject . Now I want to set these property values to the DependencyObject . Any idea on how this can be achieved? Thanks. 回答1: You can get DependencyPropertyDescriptor using DependencyPropertyDescriptor.FromName method and then get dependency property identifier from this descriptor. var descriptor = DependencyPropertyDescriptor.FromName( propertyName,