Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf 无法从Radcombobox获取所需的功能_Wpf_Vb.net_Radcombobox - Fatal编程技术网

Wpf 无法从Radcombobox获取所需的功能

Wpf 无法从Radcombobox获取所需的功能,wpf,vb.net,radcombobox,Wpf,Vb.net,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()

我希望在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:


下拉列表正确显示图像。我无法获取要显示在cbo文本部分的图像名称,也无法获取返回数据库的路径


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

这是显示图像名称所需的。来自和的想法:

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

<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>
TextSearch.TextPath="logoName"