Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4025304
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:49:48+00:00 2026-05-20T10:49:48+00:00

I have the following code: private void Package_ContactDown(object sender, ContactEventArgs e) { ScatterViewItem svi

  • 0

I have the following code:

 private void Package_ContactDown(object sender, ContactEventArgs e)
        {
            ScatterViewItem svi = new ScatterViewItem();
            svi.Orientation = 0;
            removeShadow(svi);
            svi.IsActive = true;
            PackageView view = new PackageView(sourceFile, this);
            view.setScatterViewItem(svi);
            svi.Width = 1024;
            svi.Height = 768;
            svi.Center = new Point(512, 384);

            Viewbox box = new Viewbox();
            box.Name = "box";
            box.Child = view;
            this.RegisterName(box.Name, box);

            Viewbox boxSmall = new Viewbox();
            boxSmall.Name = "boxSmall";
            this.RegisterName(boxSmall.Name, boxSmall);
            TextBlock txt = new TextBlock();

            txt.Foreground = Brushes.White;
            txt.Text = "Package of class";
            boxSmall.Child = txt;
            boxSmall.Opacity = 0;
            boxSmall.IsHitTestVisible = false;

            Rectangle border = new Rectangle();
            border.Name = "border";
            this.RegisterName(border.Name, border);
            border.Fill = Brushes.Transparent;
            border.Stroke = Brushes.White;
            border.StrokeThickness = 2;
            border.Opacity = 0;

            Grid g = new Grid();
            g.Background = this.FindResource("WindowBackground") as ImageBrush;
            g.Children.Add(box);
            g.Children.Add(boxSmall);
            g.Children.Add(border);
            svi.Content = g;

            window.IconDisplay.Items.Add(svi);

            DoubleAnimation animation = new DoubleAnimation();
            animation.From = 0.0;
            animation.To = 1.0;
            animation.Duration = new Duration(TimeSpan.FromSeconds(3));
            animation.AutoReverse = false;

            Storyboard storyboard = new Storyboard();
            storyboard.Children.Add(animation);
            Storyboard.SetTargetName(animation, boxSmall.Name);
            Storyboard.SetTargetProperty(animation, new PropertyPath(Viewbox.OpacityProperty));

            DoubleAnimation animation2 = new DoubleAnimation();
            animation2.From = 1.0;
            animation2.To = 0.0;
            animation2.Duration = new Duration(TimeSpan.FromSeconds(3));
            animation2.AutoReverse = false;

            Storyboard storyboard2 = new Storyboard();
            storyboard2.Children.Add(animation2);
            Storyboard.SetTargetName(animation2, box.Name);
            Storyboard.SetTargetProperty(animation2, new PropertyPath(Viewbox.OpacityProperty));

            DoubleAnimation animation3 = new DoubleAnimation();
            animation3.From = 0.0;
            animation3.To = 1.0;
            animation3.Duration = new Duration(TimeSpan.FromSeconds(3));
            animation3.AutoReverse = false;

            Storyboard storyboard3 = new Storyboard();
            storyboard3.Children.Add(animation3);
            Storyboard.SetTargetName(animation3, border.Name);
            Storyboard.SetTargetProperty(animation3, new PropertyPath(Rectangle.OpacityProperty));

            svi.SizeChanged += delegate(object s, SizeChangedEventArgs args)
            {
                if (args.NewSize.Width < 150 && args.NewSize.Height < 150 && !isSmall)
                {
                    svi.CanScale = false;
                    storyboard.Begin(this);
                    storyboard2.Begin(this);
                    storyboard3.Begin(this);
                    storyboard3.Completed += delegate(object sender2, EventArgs args2)
                    {
                        Console.WriteLine("Storyboard completed");
                        svi.CanScale = true;
                    };
                    isSmall = true;
                }

                if (args.NewSize.Width > 150 && args.NewSize.Height > 150 && isSmall)
                {
                    isSmall = false;
                }
            };

        }

And I noticed that the Storyboard#completed Event is never triggered. Why? And an additional question… Is there any way to reverse all these 3 animations? If I want to display the animations the other way round?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:49:48+00:00Added an answer on May 20, 2026 at 10:49 am

    The completed event will not fire the first time around because it is not set before you call the begin method. Set the completed handler then call the begin and you should see the handler get called.

    Is there a reason that you have three storyboards? Storyboards can contain multiple animations and you could just put all the animations into one storyboard. This would simplify reversing the storyboard.

            DoubleAnimation animation = new DoubleAnimation();
            animation.From = 0.0;
            animation.To = 1.0;
            animation.Duration = new Duration(TimeSpan.FromSeconds(3));
            animation.AutoReverse = false;
    
            DoubleAnimation animation2 = new DoubleAnimation();
            animation2.From = 1.0;
            animation2.To = 0.0;
            animation2.Duration = new Duration(TimeSpan.FromSeconds(3));
            animation2.AutoReverse = false;
    
            DoubleAnimation animation3 = new DoubleAnimation();
            animation3.From = 0.0;
            animation3.To = 1.0;
            animation3.Duration = new Duration(TimeSpan.FromSeconds(3));
            animation3.AutoReverse = false;
    
            Storyboard storyboard = new Storyboard();
            storyboard.AutoReverse = true;
            storyboard.Children.Add(animation);
            Storyboard.SetTargetName(animation, boxSmall.Name);
            Storyboard.SetTargetProperty(animation, new PropertyPath(Viewbox.OpacityProperty));
    
            storyboard.Children.Add(animation2);
            Storyboard.SetTargetName(animation2, box.Name);
            Storyboard.SetTargetProperty(animation2, new PropertyPath(Viewbox.OpacityProperty));
    
            storyboard.Children.Add(animation3);
            Storyboard.SetTargetName(animation3, border.Name);
            Storyboard.SetTargetProperty(animation3, new PropertyPath(Rectangle.OpacityProperty));
    
            svi.SizeChanged += delegate(object s, SizeChangedEventArgs args)
            {
                if (args.NewSize.Width < 150 && args.NewSize.Height < 150 && !isSmall)
                {
                    svi.CanScale = false;
                    storyboard.Completed += (o, s) =>
                    {
                        Console.WriteLine("Storyboard completed");
                        svi.CanScale = true;
                    };
                    storyboard.Begin(this);
                    isSmall = true;
                }
    
                if (args.NewSize.Width > 150 && args.NewSize.Height > 150 && isSmall)
                {
                    isSmall = false;
                }
            };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am work with SharpPcap library. I have following code: private void button1_Click(object sender,
I have the following code: private static void WriteStartupInfo() { Settings settings = Settings.Default;
I have this following code for bringing page attachments to the user: private void
I have the following method in my code: private bool GenerateZipFile(List<FileInfo> filesToArchive, DateTime archiveDate)
With a listbox, I have the following code to extract the item selected: private
I have the following code: $bind = new COM(LDAP://CN=GroupName,OU=Groups,OU=Division,DC=company,DC=local); When I execute it from
I have following code I want to test: public class MessageService { private MessageDAO
I have the following code: public function Application() { loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have following Code Block Which I tried to optimize in the Optimized section

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.