This is a migrated thread and some comments may be shown as answers.

Add Q3 Coverflow to Grid runtime

1 Answer 41 Views
CoverFlow
This is a migrated thread and some comments may be shown as answers.
Henk
Top achievements
Rank 1
Henk asked on 05 Nov 2009, 03:42 PM
I try to add a CoverFlow to a grid at runtime.
In the Coverflow Images should be shown.
ItemsSource of the CoverFlow is connected to a collection of objects that have a ImageURL property.
ImageURL value is for instance "/Images/nature1.png"
Images are stored in "ClientBin/Images"

CoverFlow = new RadCoverFlow(){ReflectionStartAlpha=100,  
                               ReflectionRelativeHeight = 0.3,  
                               CameraY = -120,  
                               ItemMaxHeight = 140,  
                               Height = 200 };  
Grid1.Children.Add(CoverFlow);  
CoverFlow.DisplayMemberPath = "ImageUrl";  
AntwoordCoverFlow.ItemsSource = ImageCollection; 

If I run the application only the ImageURL is shown as text in the CoverFlow.
In the Q2 version I had no problem.
Is an item template mandatory for the items in the CoverFlow in Q3? If yes how can I assign it in code behind. I don't have a XAML file.

1 Answer, 1 is accepted

Sort by
0
Accepted
Valeri Hristov
Telerik team
answered on 05 Nov 2009, 03:55 PM
Hi Henk,

Infortunately setting ItemTemplate is mandatory at this time. You could set it from code-behind using XamlReader (in Silverlight you cannot create DataTemplate purely with code) and the string representation of the template XAML. For example:

string data = @"<DataTemplate xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""><Image Source=""{Binding ImageUrl}"" /></DataTemplate>";

DataTemplate template = (DataTemplate)XamlReader.Load(data);

Best wishes,
Valeri Hristov
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
CoverFlow
Asked by
Henk
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Share this question
or