我正在尝试扩展内置的 Choice 字段类型以包含另一条数据:正确答案。这样,用户将能够直接在 Sharepoint 中创建自己的测试,而不必使用 InfoPath 或其他一些复杂的解决方案。我希望继承现有的 SPFieldChoice 类型,并添加一个自定义属性来保存一个整数,该整数表示所输入选项的正确答案。
我有一个继承自 SPFieldChoice 的 FieldTestQuestion 类,以及一个继承自 RadioButtonChoiceField 的非常基本的 TestQuestionFieldControl 类。我的 fldtypes_TestQuestionField.xml 文件:
<FieldTypes>
<FieldType>
<Field Name="TypeName">TestQuestion</Field>
<Field Name="ParentType">Choice</Field>
<Field Name="TypeDisplayName">Test Question (Multiple choice)</Field>
<Field Name="TypeShortDescription">Test Question (Multiple choice)</Field>
<Field Name="UserCreatable">TRUE</Field>
<Field Name="ShowInColumnTemplateCreate">TRUE</Field>
<Field Name="FieldTypeClass">MyCustomFieldTypes.FieldTestQuestion,MyCustomFieldTypes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=****</Field>
<PropertySchema>
<Fields>
<Field Name="CorrectAnswer" DisplayName="Correct answer (line number)" Type="Integer">
<Default></Default>
</Field>
</Fields>
</PropertySchema>
</FieldType>
</FieldTypes>
Unfortunately, this is what renders when I try adding a column of this type:
(source: mudman.us http://www.mudman.us/stackoverflow/TestQuestionFieldCustomProperties.png)
No option to add the choices as with the Choice field type:
(source: mudman.us http://www.mudman.us/stackoverflow/ChoiceFieldCustomProperties.png)
我需要在 fldTypes_.xml 中添加什么内容来告诉 Sharepoint (a) 使用 Choice 列的现有自定义属性并添加我指定的额外属性,或者 (b) 专门定义多行文本自定义属性?