Ok, so I tried to implement the coverage found on codeplex http://silverlightcoverflow.codeplex.com/
I wanted to use my own class to bind data:
class CoverItem { BitmapImage _image; string _title; string _link; string _content; public BitmapImage Image { get { return _image; } set { _image = value; } } public string Title { get { return _title; } set { _title = value; } } public string Link { get { return _link; } set { _link = value; } } public string Content { get { return _content; } set { _content = value; } } }
This is the XAML for the codeplex cover user control:
<custom:CoverFlowControl.ItemTemplate> <DataTemplate> <StackPanel> <Image Source="{Binding Image}" Width="300" /> <TextBlock Text="{Binding Title}" Width="300" /> <TextBlock Text="Testing" Width="300" /> </StackPanel> </DataTemplate> </custom:CoverFlowControl.ItemTemplate>
The problem I am facing is that I get the word "Test" for every related item, but I do not get the image or title that belong to my objects attached to the ItemSource property of the control.
Covers.ItemsSource = _items;
My question is: where am I mistaken? This should be a simple snap, so I think I'm missing something.
Thanks in advance for your help.
EDIT:
If I change the code to this:
List<BitmapImage> images = new List<BitmapImage>() { _items[0].Image, _items[1].Image, _items[2].Image, _items[3].Image }; Covers.ItemsSource = images;
And then bind it like:
<Image Source="{Binding}" Width="300" />
Now I get my images. So I know this is a binding problem somewhere.
Also tried
<Image Source="{Binding Path=Image}" Width="300" />