This is killing me, I can't get an image to display as a list box item: here is my code:
WPF:
// listbox called lstWidgets
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Name="txtTitle" Margin="2,5,5,2" Text="{Binding name}" />
<Image Name="imgDisp" Source="{Binding img}" Width="50" Height="50"/>
.....
C#:
Class widget / props: string name, Image img (get,set)...
ObservableCollection<cls_Widget> widgets....
Image newImage = new Image();
newImage.Source = new ImageSourceConverter().ConvertFromString("")as ImageSource;
cls_Widget wdg = new cls_Widget();
wdg.img = newImage
wdg.name = "My Widget";
widgets.Add(wdg);
lstWidgets.ItemsSource = widgets;
....
The textblock Text is displayed, but the image is not (the image area is blank).. I appreciate any help! I have gotten and image to display in different code scenarios, but not this one...
Thanks in advance.