Ok, So I have tried to implement a coverflow found on codeplex http://silverlightcoverflow.codeplex.com/
I wanted to use my own class for data binding:
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 Cover User Control from codeplex:
<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 having is that I get word "Testing" for each element that was bound, but I am not getting image or the title, which are from my objects that attached to the ItemSource property of the control.
Covers.ItemsSource = _items;
My question is, where am I going wrong? This should be a simple binding, so think I am missing something.
Thanks in advance for the 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;// _items;
And then have the binding as this:
<Image Source="{Binding}" Width="300" />
I now get my images displaying. So I know it is a problem with the binding somewhere.
Have also tried
<Image Source="{Binding Path=Image}" Width="300" />