0
我有我的自動完成框的下面的代碼,我正在嘗試做我覺得很簡單。我有一個用戶和用戶ID列表。我希望用戶輸入「jim」並查看「jim」,但將我的值綁定到user_id,例如「3」,然後當表單重新加載時將值綁定到「3」但顯示「jim」Silverlight自動完成框
這是可能,如果是的話,我在下面做了什麼不正確的?
在此先感謝
Public Class ADUsersConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
If value Is Nothing Then Return Nothing
Dim u As SER_User.usp_Get_All_Active_usersResult = TryCast(value, SER_User.usp_Get_All_Active_usersResult)
If Not u Is Nothing Then Return u.Display_Name
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Return Nothing
End Function
末級
「XAML
<sdk:AutoCompleteBox Name="acb_reviewedby" HorizontalAlignment="Stretch" Grid.Column="6" Grid.Row="3" Margin="5" Text="{Binding Path=Reviewed_By, Mode=TwoWay}" MinimumPopulateDelay="500" ValueMemberBinding="{Binding Converter={StaticResource ADUsersConvert}}">
<sdk:AutoCompleteBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Display_Name}"></TextBlock>
</DataTemplate>
</sdk:AutoCompleteBox.ItemTemplate>
</sdk:AutoCompleteBox>
我不知道我跟着你。請您詳細說明或提供樣品嗎? – Jim