locked
How to make Slideshow with fade in fade out effect in Expression Blend, WPF RRS feed

  • Question

  • Hi everybody.........

    I tried to create a slideshow with fadein/fade out effect in WPF.

    It is  working fine but when it repeats, means when 1st frame start rendering after last frame it shows a blank.

     

    I don’t know how to avoid this….

     

    My frames are XAML code, which I am loading at runtime.

     

    Code for animation………..

     Canvas[] canvasList;
    
    
    
       Storyboard myStoryboard;
    
    
    
        ParallelTimeline Ptime;
    
    
    
       DoubleAnimation[] da; 
    
    
    
      
    
    
    
    double interval1 = 5;
    
    
    
    
    
    
    
      myStoryboard = new Storyboard();
    
    
    
                    Ptime = new ParallelTimeline();
    
    
    
       da = new DoubleAnimation[4];
    
    
    
    
    
    
    
     for (int k = 0; k < 4; k++)
    
    
    
                    {
    
    
    
                        da[k] = new DoubleAnimation(1, 0, TimeSpan.FromSeconds(20));
    
    
    
                       
    
    
    
                        da[k].AccelerationRatio = 0.5;
    
    
    
                        da[k].DecelerationRatio = 0.5;
    
    
    
                        da[k].BeginTime = TimeSpan.FromSeconds(interval1);
    
    
    
                        interval1 = interval1 + Properties.Settings.Default.AnimationSpeed;
    
    
    
                        Ptime.Children.Add(da[k]);
    
    
    
     //canvasList Canvas Containers for each XAML File to be loaded.
    
    
    
                        Storyboard.SetTargetName(da[k], canvasList[k].Name);
    
    
    
                        Storyboard.SetTargetProperty(da[k], new PropertyPath(Canvas.OpacityProperty));
    
    
    
                       
    
    
    
                    }
    
    
    
                   
    
    
    
                    LoadPlantAnimation();
    
    
    
            }
    
    
    
    
    
    
    
               }
    
    
    
            public void LoadPlantAnimation()
    
    
    
            {
    
    
    
                //Starting animation for loaded XAML files
    
    
    
    
    
    
    
    
    
    
    
                myStoryboard.Children.Add(Ptime);
    
    
    
                Ptime.RepeatBehavior = RepeatBehavior.Forever;
    
    
    
                
    
    
    
                myStoryboard.Begin(this);
    
    
    
    
    
    
    
    
    
    
    
            }
    
    
    
    


    I tryed in Expression Blend 1 also, but it is
    1) not showing intervals between frame change
    2) My no of frames is not fixed, so i don't knw how to deal with it in XAML

    looking for guidance ............

    Friday, November 6, 2009 9:45 AM