0
디자인 타임에 구성 요소에 새 속성을 추가하려고합니다. 이 속성은 디자인 뷰에 표시되지만 값을 수정할 수 없으며 "개체 참조가 개체의 인스턴스로 설정되지 않았습니다"로 표시됩니다. 속성을 인스턴스화해야하는 경우 MSDN과 Google이 실패합니다.내가 추가하는 디자인 타임 구성 요소 속성에 디자인보기에서 변경할 수없는 값으로 null 참조 오류가 있습니다.
어디로 잘못 가고 있습니까? 다음은 문제를 나타내는 코드의 약식 버전입니다.
[DesignerAttribute(typeof(designPropDesigner))]
public class designProp : Component
{
public class designPropDesigner : ComponentDesigner
{
protected override void PreFilterProperties(IDictionary properties)
{
base.PreFilterProperties(properties);
var prop = TypeDescriptor.CreateProperty(typeof(designPropDesigner), "prop", typeof(string), new Attribute[] { DesignOnlyAttribute.Yes, new DefaultValueAttribute("") });
properties.Add("prop", prop);
}
}
}