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 5990217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:12:41+00:00 2026-05-22T23:12:41+00:00

I am a beginner in Silverlight. I took a border control, on mouse over

  • 0

I am a beginner in Silverlight. I took a border control, on mouse over of which I want to increase its width, but slowly in an animated way, and on mouse out back to normal

<Border BorderBrush="#528CC1" Background="#164A7A" MouseEnter="bHome_MouseEnter"
        MouseLeave="bHome_MouseLeave" Opacity="0.75" BorderThickness="1" Height="75" Width="110"
        Grid.Column="1" x:Name="bProduct" Margin="0,0,0,0" Cursor="Hand" VerticalAlignment="Top">
 private void bHome_MouseEnter(object sender, MouseEventArgs e)
    {
        Border border = (Border)sender;
        border.Width = 160;
        border.Opacity = 100;
    }

    private void bHome_MouseLeave(object sender, MouseEventArgs e)
    {
        Border border = (Border)sender;
        border.Width = 110;
        border.Opacity = 0.75;
    }
  • 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-22T23:12:42+00:00Added an answer on May 22, 2026 at 11:12 pm

    If you really want to do it with code (it’s way way easier to do with visual states, even the mouse over / out is handled for you out of the box, just have to set starting and ending parameters in XAML, however if the values are dynamic, it’s not possible, you can’t do binding in the VisualStateManager markup as it’s not part of the visual tree), here’s an example (from http://msdn.microsoft.com/en-us/library/cc189069(VS.95).aspx#procedural_code ):

    The following example shows how to create an animation that animates Canvas.Top and Canvas.Left attached properties of a rectangle.

    private void Create_And_Run_Animation(object sender, EventArgs e)
    {
        // Create a red rectangle that will be the target
        // of the animation.
        Rectangle myRectangle = new Rectangle();
        myRectangle.Width = 200;
        myRectangle.Height = 200;
        Color myColor = Color.FromArgb(255, 255, 0, 0);
        SolidColorBrush myBrush = new SolidColorBrush();
        myBrush.Color = myColor;
        myRectangle.Fill = myBrush;
    
        // Add the rectangle to the tree.
        LayoutRoot.Children.Add(myRectangle);
    
        // Create a duration of 2 seconds.
        Duration duration = new Duration(TimeSpan.FromSeconds(2));
    
        // Create two DoubleAnimations and set their properties.
        DoubleAnimation myDoubleAnimation1 = new DoubleAnimation();
        DoubleAnimation myDoubleAnimation2 = new DoubleAnimation();
    
        myDoubleAnimation1.Duration = duration;
        myDoubleAnimation2.Duration = duration;
    
        Storyboard sb = new Storyboard();
        sb.Duration = duration;
    
        sb.Children.Add(myDoubleAnimation1);
        sb.Children.Add(myDoubleAnimation2);
    
        Storyboard.SetTarget(myDoubleAnimation1, myRectangle);
        Storyboard.SetTarget(myDoubleAnimation2, myRectangle);
    
        // Set the attached properties of Canvas.Left and Canvas.Top
        // to be the target properties of the two respective DoubleAnimations.
        Storyboard.SetTargetProperty(myDoubleAnimation1, new PropertyPath("(Canvas.Left)"));
        Storyboard.SetTargetProperty(myDoubleAnimation2, new PropertyPath("(Canvas.Top)"));
    
        myDoubleAnimation1.To = 200;
        myDoubleAnimation2.To = 200;
    
        // Make the Storyboard a resource.
        LayoutRoot.Resources.Add("unique_id", sb);
    
        // Begin the animation.
        sb.Begin();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not a beginner at C# but I really need to increase my understanding,
Once again a very beginner-ish question, but here I go: I would like to
I'm following this tutorial (beginner Hello World Silverlight Application) In this step it shows
I'm am currently developing a silverlight application, I am still a beginner with this.
Beginner to assembly programming for x86. I have a simple asm file which I
Beginner question -- what do you usually use as a multimap? I want a
Beginner Node question. I'm running a Node/Express app, and I want to send client-side
VS beginner question. How to change parent control of a control? Example. I have
A beginner question I am sure, but I have just started working with a
A beginner question, bear with me: I'm just wondering under what circumstances one should

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.