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

Programmatically Adding an Image to the Items

5 Answers 108 Views
CoverFlow
This is a migrated thread and some comments may be shown as answers.
Dennis
Top achievements
Rank 1
Dennis asked on 20 Aug 2009, 10:55 PM
I am programmatically adding an image to the Items, but I only get the loading picture and not the picture I am passing to it. I am doing the following: (1) capturing a screenshot of the RootVisual into a WriteableBitmap, (2) mapping the capture into a new Image control, and (3) adding the Image control into the RadCoverFlow control. I have an additional Image control (ImageTest) that I am using to verify that the capture does and does display in an image control. Please see below code.

            System.Windows.Media.Imaging.WriteableBitmap pageCapture = new System.Windows.Media.Imaging.WriteableBitmap (App.Current.RootVisual, new TranslateTransform ());  
 
            Image pageCaptureImage = new Image ();  
 
            pageCaptureImage.Source = pageCapture;  
 
            myRadCoverFlow.Items.Add (pageCaptureImage);  
 
 
            ImageTest.Source = pageCapture; 

Thanks.
Dennis

5 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 21 Aug 2009, 08:54 PM
Hello Dennis,

Unfortunately the CoverFlow control doesn't work correctly with writable bitmaps. You could wait for the new version of the CoverFlow control - it will have more features and will work with UIElements.

The final version will be released with the Q3 release, but we should release beta version soon.

Regards,
Miroslav Nedyalkov
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
0
Dennis
Top achievements
Rank 1
answered on 09 Nov 2009, 09:25 PM
Is this functionality now in the new release? Or do you have another way to add WriteableBitmaps into the CoverFlow control?
0
Hristo Borisov
Telerik team
answered on 10 Nov 2009, 09:16 AM
Hello Dennis,

I guess you should not face any problems using WriteableBitmaps with our new controls as it now supports even UI Elements. If you face any difficulties wiring up to a writeablebitmap collection, please get back to us with your scenario and we will more than glad to help you resolve your issue. To learn more about our API changes, please take a look at this blog post.

We look forward to hearing again from you.

Kind regards,
Hristo Borisov
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.
0
Dennis
Top achievements
Rank 1
answered on 10 Nov 2009, 06:23 PM
It still does not show the image in the RadCoverFlow. It shows a refresh animation. When I assign the same WriteableBitmap to a standard Image control (through Source), it shows the images as expected. Even if I add the Image into the Items collection on the RadCoverFlow for the Image I just assigned the WriteableBitmap, it does not work.

I cannot just add the user control directly in because I don't want it to be active, just a capture of what it last looked like before (in otherwords a "preview" of the control). My goal is to use the RadCoverFlow to offer a choice (through previews) of active User Controls.

Still need help with this one. How would you approach adding a "capture" of a user control as a preview into the RadCoverFlow?
0
Accepted
Hristo Borisov
Telerik team
answered on 13 Nov 2009, 02:25 PM
Hello Dennis,

I managed to reproduce the problem and I discovered that there is a bug in our RadCoverFlow.EnableLoadNotification attached property. Actually the bug comes from the Image control as it seems that if the source of an Image is set to a WriteableBitmap control, the ImageOpened event is not triggered. This is causing our animation to constantly cycle. To get around this problem, you just have to declare an ItemTemplate that does not use RadCoverFlow.EnableLoadNotification. Here is a quick example:

<teleriknav:RadCoverFlow x:Name="cover" Width="300" Height="300">
                <teleriknav:RadCoverFlow.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Image Source="{Binding}"  Width="40" Height="40" Stretch="None" />
                        </Grid>
                    </DataTemplate>
                </teleriknav:RadCoverFlow.ItemTemplate>
            </teleriknav:RadCoverFlow>

Now, if you assign a WriteableBitmap to the Items collection you will have your WriteableBitmap rendered inside the CoverFlow.

WriteableBitmap bitmap = new WriteableBitmap(button, new TranslateTransform());
cover.Items.Add(bitmap);

Thank you for mentioning this problem and for your involvement in resolving the issue. If you have any other questions, please get back to us immediately.

Kind regards,
Hristo Borisov
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
Dennis
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Dennis
Top achievements
Rank 1
Hristo Borisov
Telerik team
Share this question
or