C#C
C#3y ago
Cinthia

❔ Binding WPF Combobox

Hello,

I'm having trouble doing the Binding in WPF, I have a combobox and I want to show the image that I have saved in the images folder, and the name of the country.
I created a separate class just for ImagePath and Text, and I tried to do the Binding, but it doesn't work, does anyone have any tips on how to solve this?
And I am not using MVC.
public class Item
{
public string Name { get; set; }
public string ImagePath { get; set; }
}

<syncfusion:ComboBoxAdv x:Name="ComboBoxCountries" AllowMultiSelect="False" DefaultText="Countries List" Foreground="#333333" Height="35" Width="350" Margin="30,60,740,516"
ItemsSource="{Binding Template}"
SelectionChanged="ComboBoxCountries_SelectionChanged">
<syncfusion:ComboBoxItemAdv>

<StackPanel Orientation="Horizontal">
<Image Source="{Binding ImagePath}" Width="20"
Height="20"
Margin="0,0,5,0"/>
<TextBlock Text="{Binding Text}"/>
</StackPanel>

</syncfusion:ComboBoxItemAdv>
</syncfusion:ComboBoxAdv>
Was this page helpful?