internal CommandTarget(Component component) { Component = component; var eventName = GetDefaultEventName(component.GetType()); _defaultEvent = Internals.SourceTypeDescriptor.GetEvent(component, eventName); _enabledProperty = Internals.SourceTypeDescriptor.GetProperty(component, "Enabled"); }
public static SourcePropertyDescriptor GetProperty(Type sourceType, string propertyName) { return(GetOrCreateMember(sourceType, propertyName, (type, pro) => { var property = new SourcePropertyDescriptor(type.GetProperty(pro, Reflection.BindingFlags.Public | Reflection.BindingFlags.NonPublic | Reflection.BindingFlags.Instance | Reflection.BindingFlags.Static)); return property; })); }
internal CommandTarget(Component component, string eventName) { Component = component; _defaultEvent = Internals.SourceTypeDescriptor.GetEvent(component, eventName); _enabledProperty = Internals.SourceTypeDescriptor.GetProperty(component, "Enabled"); }
/// <summary> /// 初始化 <see cref="ComponentProperty"/> 新实例。 /// </summary> /// <param name="component"></param> /// <param name="propertyName"></param> public ComponentProperty(Component component, string propertyName) { Component = component; PropertyName = propertyName; bindingProperty = Internals.SourceTypeDescriptor.GetProperty(component, propertyName); }