Carousel content problem

9 posts, 0 answers
  1. Oliver
    Oliver avatar
    263 posts
    Member since:
    Feb 2011

    Posted 16 May 2012 Link to this post

    Hi,

    in my application I use a RadCarousel. When I click on my document RadButton, I open a PDF document with 2 pages, I extract each page as an image, after each image extraction, I the add the new created image into my RadCarousel and I call the following method:
     

    pCarousel.BringDataItemIntoView(pCarousel.Items[0]);

    to have the first page ont top. The 2nd page in my carousel sill white (empty) until I scroll the 2nd page ouside the carousel view and bring it back into th carousel view, at this time I can see the 2nd page content.

    Thank's

     

  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 16 May 2012 Link to this post

    Hi Oliver,

    In order to suggest any further, I would need a bit more information about your exact scenario. Will it be possible to share more details on it and some relevant code snippets illustrating what you do ? 

    Kind regards,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Oliver
    Oliver avatar
    263 posts
    Member since:
    Feb 2011

    Posted 16 May 2012 Link to this post

    Hi Maya,

    the flow is going like this:

    - I have a grid with data
    - The user have to select one row and click on the "Show document" button
    - I start a thread that make a call to my backend to receive the PDF document (document can have one or 2 pages)
    - When receive is completed, I start another thread to extract each page of the document and transform it into an "Image"
    - For each new created image, I add it to my carousel (see code snippet at the end)
    - With a 1 page document, fine, no problem.
    - With a 2 pages document, I see the first page with is content but the second page was empty and white.
    - I scroll the 2nd page outsite the visible area of the carousel and I bring it back into the visible area of the carousel and now, I can see the content of the 2nd page.

            private void delayedPdfToImageConverter(object pPdf)
            {
                if (mCarouselToUseDuringDocsThread != null && pPdf != null)
                {
        var img = pPdf as InterDependencyImage;
                    img.Image = new Image();
                    img.Image.Source = img.Frame;    
        mCarouselToUseDuringDocsThread.Items.Add(img);    

                    if (mCarouselToUseDuringDocsThread.Items.Count > 0)
                    {                   
                        if (mCarouselToUseDuringDocsThread.Items.Count == 1)
                        {
                            // Validate if it's a new document.
                            if (mCarouselToUseDuringDocsThread == SignCtxDocsCarousel)
                            {
                                mSignCtxNewIncomingDoc = true;
                            }
                            else
                            {
                                mUnsignCtxNewIncomingDoc = true;
                            }      
                        }

         // Bring the first received image on top.     
         mCarouselToUseDuringDocsThread.BringDataItemIntoView(mCarouselToUseDuringDocsThread.Items[0]);     
                    }
                }
            }


  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 22 May 2012 Link to this post

    Hello Oliver,

    I have tried to reproduce the issue you reported, but unfortunately without any success. Could you verify whether the second image is created once it should be displayed ? Could you try displaying simple images, instead of such converted from pdf just to check whether the problem is with the timing ? How do you add each of those images to the source of the carousel ?  

    Regards,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Oliver
    Oliver avatar
    263 posts
    Member since:
    Feb 2011

    Posted 28 May 2012 Link to this post

    Hi,

    answers:

    Could you verify whether the second image is created once it should be displayed ?
    Yes
     
    Could you try displaying simple images, instead of such converted from pdf just to check whether the problem is with the timing ?
    All images I show in my carousel comes from a PDF document. If I have 2 documents with 1 page each, all pages are displayed correctly. The problem occured only when I have a PDF document with 2 pages. What I did exactly is, a person can have 1 or more document with one or multiple plages for each document. In my carousel, I have to display all document pages. 
     
    How do you add each of those images to the source of the carousel ?
    MyCarousel.Items.Add(img);

    Thank's
  7. Nick
    Admin
    Nick avatar
    593 posts

    Posted 31 May 2012 Link to this post

    Hello Oliver,

    We still are not able to reproduce the issue on our side. Would it be possible to send a sample project that demonstrates the false behavior so we can debug it on our side, in order to provide further assistance?

    Looking forward to your response! 

    All the best,
    Nik
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  8. Steven
    Steven avatar
    3 posts
    Member since:
    Jul 2012

    Posted 13 Jul 2012 Link to this post

    Hi

    I think that my problem has the same cause as this problem.

    I am using a RadCarousel, with ItemTemplate x.
    The ItemTemplate x is a DataTemplate.  This DataTemplate has a Border, and the Border's background color is set by a DataTrigger set in the DataTemplate.
    Thus: the DataTemplate contains some DataTriggers which set the Background of the Border in the DataTemplate.

    What happens is the next: in the Border I have a button.  This button calls a command in my ViewModel.  The ViewModel sets a property which causes the DataTriggers to change the background of the Border.
    The problem is: it seems that the DataTriggers are only triggerd, after I select another Item in the Carousel.
    Say f.i. that the Background is Green at the beginning, I click the button, which should set the Background to Red (with a storyboard).  The color only starts to animate from Green to Red after I select another item in the carousel.

    it seems that the carousel only updates items whenever some event is called.

    Is there a solution/workaround for this problem?  Preferably in XAML (because for requirement reasons, I cannot use too much code, except from Attached Behaviors maybe).

    Thank you
    Steven
  9. Steven
    Steven avatar
    3 posts
    Member since:
    Jul 2012

    Posted 16 Jul 2012 Link to this post

    It gets even weirder.  Should I create a new thread for this?

    I had created an attached behavior for the RadCarousel, because I couldn't get my first item of the ItemsSource to be visible upon start of my application.
    The attached behavior is coded as below:
    //ctrl = RadCarousel
    //item = my custom class, which is in the ItemsSource collection
    ctrl.BringDataItemIntoView(item);
    ctrl.SelectedItem = item;

    Whenever this method is called, the DataTriggers in my ItemTemplate are executed.  However, they are executed over and over again.  Say f.i. that the DataTrigger changes the background from green to orange, then everytime this code is called, the background changes again from green to orange.  If I would skip the code (breakpoint + skip these two lines), then nothing is updated.  Even those who actually would have to change from green to orange, don't.

    I really don't understand how the RadCarousel is set up to update any layouts or start datatriggers, but I would have expected this to be independent from the RadCarousel.
  10. Nick
    Admin
    Nick avatar
    593 posts

    Posted 18 Jul 2012 Link to this post

    Hi Steven,

    Could you open a support ticket and attach the project there so we can debug it on our side and see what's wrong? 

    Looking forward to hearing from you. 

    Greetings,
    Nik
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
UI for WPF is Visual Studio 2017 Ready