Programmatically Adding an Image to the Items

6 posts, 1 answers
  1. Dennis
    Dennis avatar
    62 posts
    Member since:
    Oct 2007

    Posted 20 Aug 2009 Link to this post

    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
  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 21 Aug 2009 Link to this post

    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.
  3. DevCraft banner
  4. Dennis
    Dennis avatar
    62 posts
    Member since:
    Oct 2007

    Posted 09 Nov 2009 Link to this post

    Is this functionality now in the new release? Or do you have another way to add WriteableBitmaps into the CoverFlow control?
  5. Hristo Borisov
    Admin
    Hristo Borisov avatar
    298 posts

    Posted 10 Nov 2009 Link to this post

    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.
  6. Dennis
    Dennis avatar
    62 posts
    Member since:
    Oct 2007

    Posted 10 Nov 2009 Link to this post

    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?
  7. Answer
    Hristo Borisov
    Admin
    Hristo Borisov avatar
    298 posts

    Posted 13 Nov 2009 Link to this post

    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.
Back to Top
DevCraft banner