//给属性设置值 private void SetPropertyValue(object value) { //分割属性部分 string[] names = this.PropertyName.Split('.'); //循环获取对象 CustomTypeHelper obj = this.Object; for (int i = 0; i < names.Length - 1; i++) { obj = (CustomTypeHelper)obj.GetPropertyValue(names[i]); } //给最后的对象赋值 obj.SetPropertyValue(names[names.Length - 1], value, false); }
public static void SetContext(FrameworkElement ui, CustomTypeHelper value) { ui.SetValue(ContextProperty, value); }