问题描述
我有一个这样定义的智能字段:
<smartField:SmartField value="{MarktID}" textInEditModeSource="ValueList" >
<smartField:configuration>
<smartField:Configuration preventInitialDataFetchInValueHelpDialog="false" displayBehaviour="idAndDescription"/>
</smartField:configuration>
</smartField:SmartField>
它是这样呈现的(即具有值帮助的文本框):
因为我的注释文件中有以下定义:
<Annotations Target="Metadata.Meldungen/MarktID">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="CollectionPath" String="MarktSet"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="MarktID"/>
<PropertyValue Property="ValueListProperty" String="ID"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="Name"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
当我打开值帮助对话框时,就像这样:
问题是,如何在智能字段中显示所选项目的名称。我的意思是不是要显示1300
(如第一张图片所示),而是要在智能字段本身中显示1300 (Cimt Handelsgruppe)
。
解决方法
首先,基于this example,我需要像这样更改注释:
<Annotations Target="Metadata.Meldungen/MarktID">
<Annotation Term="Common.Text" Path="Markt/Name">
<Annotation Term="UI.TextArrangement" EnumMember="UI.TextArrangementType/TextLast"/>
</Annotation>
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="CollectionPath" String="MarktSet"/>
<PropertyValue Property="SearchSupported" Bool="true"/>
<PropertyValue Property="FetchValues" Int="1" />
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="MarktID"/>
<PropertyValue Property="ValueListProperty" String="ID"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="Name"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
尽管在加载对象时它会在括号中显示名称,但是更改选定的ID后它不会显示名称,除非我对主要服务模型使用TwoWay
绑定。