읽기 전용 인 사용자 정의 UityPeeditor의 ELIPSIS를 어떻게 제거합니까?
-
03-07-2019 - |
문제
속성 그리드에서 같은 유형의 필드가 있습니다. 그러나 하나는 읽기 전용이고 다른 하나는 편집 가능합니다.
이 두 필드는 모두 사용자 정의 유형이므로 사용자 정의 UityPeeditor가있어 Elipsis ([...]) 버튼을 필드에 넣습니다.
[
CategoryAttribute("5 - Wind"),
DisplayName("Factored Area"),
Description("The factored area for the segment."),
EditorAttribute(typeof(umConversionTypeEditor), typeof(UITypeEditor)),
TypeConverter(typeof(umConversionTypeConverter)),
ReadOnly(true)
]
public FactoredAreaClass FactoredArea { ... }
[
CategoryAttribute("5 - Wind"),
DisplayName("Factored Area Modifier"),
Description("The factored area modifier."),
EditorAttribute(typeof(umConversionTypeEditor), typeof(UITypeEditor)),
TypeConverter(typeof(umConversionTypeConverter))
]
public FactoredAreaClass FactoredAreaMod { ... }
이 예에서는 팩토리 레미오드를 편집 할 수 있지만 둘 다 ELIPSIS가있어 사용자와 큰 혼란을 줄 수 있습니다. 그것을 끄는 방법 ??
다른 팁
Jeff Yates 덕분에 나는 대체 솔루션을 생각해 냈습니다. 내가 그것을 해결 한 방법은 다음과 같습니다 ...
가장 큰 문제는 편집장이 실제로 인공 호에 할당되었다는 것입니다. 편집기 속성이 할당되어 있음을 보여주기 위해 원시 예제에 넣었습니다.
[
CategoryAttribute("5 - Wind"),
DisplayName("Factored Area"),
Description("The factored area for the segment."),
EditorAttribute(typeof(UITypeEditor), typeof(UITypeEditor)), // RESET THE UITYPEEDITOR to "nothing"
ReadOnly(true)
]
public FactoredAreaClass FactoredArea { ... }
[
CategoryAttribute("5 - Wind"),
DisplayName("Factored Area Modifier"),
Description("The factored area modifier."),
// the EditorAttribute and TypeConverter are part of FactoredAreaClass
]
public FactoredAreaClass FactoredAreaMod { ... }
트릭은 경계 특성이 준비된 경우 모달 스타일을 사용하지 않는 것입니다. 운 좋게도 컨텍스트는 GetEditStyle 방법으로 제공됩니다. 간단한 코드는 작업을 수행합니다.
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return context.PropertyDescriptor.IsReadOnly
? UITypeEditorEditStyle.None
: UITypeEditorEditStyle.Modal;
}
제휴하지 않습니다 StackOverflow