Skip to main content

Microsoft Silverlight

Answered Question How to show all pictures from a stack panel slide show?RSS Feed

(0)

Furnica
Furnica

Member

Member

0 points

2 Posts

How to show all pictures from a stack panel slide show?

I created an animation using a stack panel holding images retrieved from a sharepoint list. Basically it is a horizontally oriented stack panel that scrolls right to left and left to right, no problem about the animation itself.

The issue is that, if the number of images (slidespanel.children.count()) is greater than the number of images initially displayed, only the latter are scrolling, the others (those initially not visible on screen) remain allways invisible. I mean, if images 1, 2, 3, 4 and 5 are initially visible on the screen and images 6, 7 and 8 are not, well, I see only images 1 to 5 scrolling, and images 6 to 8 never become visible. Yet they are part of slidespanel.children, as I check in the debugger) and when scrolling, there is empty space where they are expected to display.

Here is the code where I load the images to the stackpanel (my slidespanel):

        void DisplayImages()
        {
            foreach (KeyValuePair<string, string> element in elt) 
            {
                Slide slide = new Slide(element.Value, element.Key);
                slide.ImageSelected += new EventHandler(ShowImage);
                slide.ImageOriginalSource = element.Value;
                SlidesPanel.Children.Add(slide);
            }
            SlidesPanel.Width = SlidesPanel.Children.Count() * 67;
            this.UpdateLayout();
        }

 

and this is my left-to-right scroll function (the right-to-left one is similar):

 

        private void LTR_Completed(object sender, EventArgs args)
        {
            Storyboard DefilerRTL = (Storyboard)this.FindName("RTL");
            DoubleAnimation animRTL = (DoubleAnimation)this.FindName("DefilerRTL");
            animRTL.From = 0;
            if (this.ActualWidth != 0)
                animRTL.To = this.ActualWidth - SlidesPanel.Children.Count() * 67;
            else
                animRTL.To = -300;
            double DimTot = System.Convert.ToDouble(animRTL.From - animRTL.To);
            double DureeTot = System.Math.Ceiling(DimTot / 300 * 7);
            animRTL.Duration = new Duration(new TimeSpan(0, 0, System.Convert.ToInt32(DureeTot)));

            RTL.Begin();
            RTL.Completed += new EventHandler(RTL_Completed);
        }

 

What do I need to change, in order that I got all images visible when scrolling?

Thank you in advance, any idea is most welcome!

 

Furnica

Furnica
Furnica

Member

Member

0 points

2 Posts

Answered Question

Re: How to show all pictures from a stack panel slide show?

That's okay, I added it on a canvas with width = "auto". It was that hard.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities