locked
LayoutRoot.Children.Remove(SplashImage); Fails w/o error!!! RRS feed

  • General discussion

  • Hi,

    I have a new Silverlight phone app that is created from the VS2010 SIlverlight Phone template... in it are a few line s of code to animate the splash screen.  But when it comes to the Remove line it executes but does NOT remove the image...

    The HTML Code...
    ----------------------------------------------------------------------------------
    !--ContentPanel - place additional content here-->

    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
    <
    my:CordovaView HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="PGView" VerticalAlignment="Stretch" />
    <Image Source="Images/SplashScreenImage.jpg" x:Name="SplashImage" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
        <Image.Projection>
            <PlaneProjection x:Name="SplashProjector" CenterOfRotationX="0"/>
        </Image.Projection>
    </Image>

    -----------------------------------------------------------------------

    The C# Code...

    public MainPage()
          {
                InitializeComponent();
          this.PGView.Loaded += GapBrowser_Loaded;
            }

    private void GapBrowser_Loaded(object sender, RoutedEventArgs e)
            {
                  this.PGView.Loaded -= GapBrowser_Loaded;
          
    Storyboard _storyBoard = new Storyboard()
           
    DoubleAnimation animation = new DoubleAnimation()
                {
                    From = 0,
                    Duration = TimeSpan.FromSeconds(0.6),|
                   To = 90
                };
                Storyboard.SetTarget(animation, SplashProjector);
          
    Storyboard.SetTargetProperty(animation, new PropertyPath("RotationY"));
                _storyBoard.Children.Add(animation);
                _storyBoard.Begin();
                _storyBoard.Completed += Splash_Completed;
             }

        void Splash_Completed(object sender, EventArgs e)
        {
                (sender as Storyboard).Completed -= Splash_Completed;
                LayoutRoot.Children.Remove(SplashImage);
            }

    ----------------------------------------------------------------------------------

    The Remove line executes but does NOT actually remove the SplashImage object.

    Anyone got any thoughts suggestions on how to fix this?

     

    Friday, July 6, 2012 2:04 PM