Moss 2010终于发布啦,关于Custom Field,并没有太大的变化,但是如果直接使用2007的Custom Field会发现FLDTypes*.xml中的RenderPattern节点里对List View的显示描述会失效。
这是因为Moss 2010中对Custom Field在List view中的显示新增了一种xslt的解析方式。而且,默认是使用这种方式,所以我们会发现以前的CAML的方式不起作用了。我们需要在fldTypes*.xml中填加<Field Name="CAMLRendering">TRUE</Field>,就能正常工作了。具体一个完整的代码如下
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
<?
xml version="1.0" encoding="utf-8"
?>
< FieldTypes >
< FieldType >
< Field Name ="TypeName" > RecommendField </ Field >
< Field Name ="ParentType" > MultiColumn </ Field >
< Field Name ="TypeDisplayName" > Recommend </ Field >
< Field Name ="TypeShortDescription" > Recommend List </ Field >
< Field Name ="UserCreatable" > TRUE </ Field >
< Field Name ="ShowOnListCreate" > TRUE </ Field >
< Field Name ="ShowOnSurveyCreate" > TRUE </ Field >
< Field Name ="ShowOnDocumentLibraryCreate" > TRUE </ Field >
< Field Name ="ShowOnColumnTemplateCreate" > TRUE </ Field >
< Field Name ="CAMLRendering" > TRUE </ Field >
< Field Name ="FieldTypeClass" > RecommendFieldType.RecommendField, $SharePoint.Project.AssemblyFullName$ </ Field >
< RenderPattern Name ="DisplayPattern" >
< Switch >
< Expr >
< Column />
</ Expr >
< Default >
< Column SubColumnNumber ="0" HTMLEncode ="TRUE" />
< HTML >
<![CDATA[ - ]]> < List /></ HTML >
< Column SubColumnNumber ="1" HTMLEncode ="TRUE" />
< Column Name ="ID" ></ Column >
</ Default >
</ Switch >
</ RenderPattern >
</ FieldType >
</ FieldTypes >
< FieldTypes >
< FieldType >
< Field Name ="TypeName" > RecommendField </ Field >
< Field Name ="ParentType" > MultiColumn </ Field >
< Field Name ="TypeDisplayName" > Recommend </ Field >
< Field Name ="TypeShortDescription" > Recommend List </ Field >
< Field Name ="UserCreatable" > TRUE </ Field >
< Field Name ="ShowOnListCreate" > TRUE </ Field >
< Field Name ="ShowOnSurveyCreate" > TRUE </ Field >
< Field Name ="ShowOnDocumentLibraryCreate" > TRUE </ Field >
< Field Name ="ShowOnColumnTemplateCreate" > TRUE </ Field >
< Field Name ="CAMLRendering" > TRUE </ Field >
< Field Name ="FieldTypeClass" > RecommendFieldType.RecommendField, $SharePoint.Project.AssemblyFullName$ </ Field >
< RenderPattern Name ="DisplayPattern" >
< Switch >
< Expr >
< Column />
</ Expr >
< Default >
< Column SubColumnNumber ="0" HTMLEncode ="TRUE" />
< HTML >
<![CDATA[ - ]]> < List /></ HTML >
< Column SubColumnNumber ="1" HTMLEncode ="TRUE" />
< Column Name ="ID" ></ Column >
</ Default >
</ Switch >
</ RenderPattern >
</ FieldType >
</ FieldTypes >