一、Text 使用情景:
1.于可以手功录入值的情况。例如可选为:A、B、C 但录入时可能录入"D" (要配合IsFilteringEnabled使用)
<s:SmartLabel Caption="類別" IsRequired="True">
<s:SmartComboBox Text="{Binding Type, Mode=TwoWay}" IsEditable="True" IsFilteringEnabled="false">
<sys:String>班車</sys:String>
<sys:String>租車</sys:String>
<sys:String>其他</sys:String>
</s:SmartComboBox>
</s:SmartLabel>
2.备选项只有一列
<s:SmartComboBox Text="{Binding Currency, Mode=TwoWay}" ItemsSource="{Binding Source={StaticResource CurrencyItems}, Path=View}" />
3.备选项有多 列
<s:SmartLabel Caption="補假日期">
<s:SmartComboBox Text="{Binding OffsetDate, Mode=TwoWay, StringFormat=yyyy-MM-dd, Converter={x:Static s:Converter.StringToDateConverter}, UpdateSourceTrigger=LostFocus}"
IsEditable="True"
IsFilteringEnabled="False"
ItemsSource="{Binding DataContext.StaffOTDates, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=s:EditorPage}}"
telerik:TextSearch.TextPath="OTDate">
<!-- 用Template顯示兩列 -->
<s:SmartComboBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding OTDate, StringFormat=yyyy-MM-dd}" />
<TextBlock Grid.Column="1" Text="{Binding RecessType}" />
</Grid>
</DataTemplate>
</s:SmartComboBox.ItemTemplate>
</s:SmartComboBox>
</s:SmartLabel>
二、SelectedValue使用情景
1. 用于通过字段关联显示另一表字段(有点类DBLookUpComboBox的影子)
<s:SmartLabel Caption="默认价码">
<s:SmartComboBox Text="{Binding aRateCode, Mode=TwoWay}"
ItemsSource="{Binding Source={StaticResource HTLRateItems}, Path=List}"
DisplayMemberPath="RateCode"
SelectedValue="{Binding RateID, Mode=TwoWay}"
SelectedValuePath="ID" />
</s:SmartLabel>