0
我希望在cbo下拉列表中顯示圖像列表,在cbo文本框中顯示圖像名稱,並將圖像路徑存儲回數據庫。無法從Radcombobox獲得所需功能
下面的代碼結合CBO:
Dim logoImages As List(Of Logos) = New List(Of Logos)
Dim theLogoName As String = String.Empty
Dim theLogoPath As String = String.Empty
thisCombo.ItemsSource = Nothing
Dim listOfImages() As String = Directory.GetFiles("C:\XXX\logo", "*.*")
For i As Integer = 0 To listOfImages.Count - 1
theLogoPath = New Uri(listOfImages(i)).AbsolutePath
theLogoName = Mid(theLogoPath, 13)
logoImages.Add(New Logos() With {.logoImage = New Uri(listOfImages(i)), .logoName = theLogoName, .logoPath = theLogoPath})
Next
thisCombo.ItemsSource = logoImages
XAML:
<telerik:RadComboBox x:Name="cboLogo" FontSize="16" Background="#F6F8FA" BorderBrush="#D7D8DD"
SelectedValue="{Binding logoPath, Mode=TwoWay}"
Text="{Binding logoName}"
IsEditable="True" IsReadOnly="True" TabIndex="9"
Style="{DynamicResource RadComboBoxStyle3}" >
<telerik:RadComboBox.ItemTemplate>
<DataTemplate>
<WrapPanel Margin="0 5 0 5" Height="70">
<Image Height="65" Stretch="Fill" Source="{Binding logoImage}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</WrapPanel>
</DataTemplate>
</telerik:RadComboBox.ItemTemplate>
</telerik:RadComboBox>
下拉正確顯示圖像。我無法獲取要在cbo的文本部分中顯示的圖像的名稱,並且無法將路徑返回到數據庫。
有人可以告訴我我做錯了什麼嗎?謝謝