public DesignerPropertyInfo(PropertyInfo property) { _property= property; DesignerProperty[] attributes= (DesignerProperty[]) _property.GetCustomAttributes(typeof(DesignerProperty), true); if(attributes.Length !=1) throw new Exception(Resources.ExceptionMultipleDesignerAttributes); _attribute= attributes[0]; }
public DesignerPropertyInfo(PropertyInfo property) { _property = property; DesignerProperty[] attributes = (DesignerProperty[])_property.GetCustomAttributes(typeof(DesignerProperty), true); if (attributes.Length != 1) { throw new Exception(Resources.ExceptionMultipleDesignerAttributes); } _attribute = attributes[0]; }
/// <summary> /// Returns the property this one is linked to. /// </summary> /// <param name="linkBroken">Is true if a link was found but it does not work.</param> /// <returns>The info of the property this is linked to.</returns> public DesignerPropertyInfo GetLinkedProperty(object obj, out bool linkBroken) { linkBroken = false; if (string.IsNullOrEmpty(_linkedToProperty)) { return(new DesignerPropertyInfo()); } DesignerPropertyInfo dpi = DesignerProperty.GetDesignerProperty(obj.GetType(), _linkedToProperty); // if we are linked to a DesignerNodeProperty we get the information of its assigned property DesignerNodeProperty dnp = dpi.Attribute as DesignerNodeProperty; if (dnp == null) { return(dpi); } Attachments.Attachment attach = (Attachments.Attachment)obj; // check if a valid property is associated object objvalue = dpi.Property.GetValue(obj, null); string value = dnp.GetDisplayValue(objvalue); if (string.IsNullOrEmpty(value) || value == Resources.DesignerNodePropertyNone) { linkBroken = true; return(new DesignerPropertyInfo()); } // return the property we are pointing at return(DesignerProperty.GetDesignerProperty(attach.Node.GetType(), value)); }
/// <summary> /// Creates a new subitem which can show a property on the node. /// </summary> /// <param name="owner">The node whose property we want to show. MUST be the same as the one the subitem belongs to.</param> /// <param name="property">The property we want to show.</param> /// <param name="att">The attribute associated with the property.</param> public SubItemProperty(Node owner, PropertyInfo property, DesignerProperty att) : base(null, null, __font, Brushes.White, Alignment.Center, false) { _owner= owner; _property= property; _attribute= att; }
public DesignerPropertyInfo(PropertyInfo property, DesignerProperty attribute) { _property = property; _attribute = attribute; }
public DesignerPropertyInfo(PropertyInfo property, DesignerProperty attribute) { _property= property; _attribute= attribute; }