无法从 Radcombobox 获得所需的功能

Unable to get desired functionality from Radcombobox

我希望在 cbo 下拉列表中显示图像列表,在 cbo 的文本框中显示图像的名称,并将图像的路径存储回数据库。

以下代码绑定了 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 的文本部分中显示的图像名称,也无法获取返回数据库的路径。

有人可以告诉我我做错了什么吗?谢谢

这是显示图片名称所需要的。来自 here and here 的想法:

TextSearch.TextPath="logoName"

将 SelectedValue 用于数据库是将路径存储回数据库所需要的。