Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

An Introduction to the Silverlight samples in the All-In-One Framework

, 12 Dec 2009 Ms-PL
This article introduces several Silverlight samples in the All-In-One Framework.
SilverlightIntroduction_src.zip
CSSL3LocalMessage
Properties
CSSL3MediaElement
CSSL3MediaElement
Properties
CSSL3MediaElement.Web
App_Data
ClientBin
CSSL3MediaElement.xap
Properties
ReadMe.mht
CSSL3PixelShader
cyclewatery.ps
Humpback Whale.jpg
Properties
CSSL3WriteableBitmap
Heart Empty.png
Properties
VBSL3Animation
My Project
VBSL3DeepZoom
VBSL3DeepZoom
images
home_hover.png
home_pressed.png
home_rest.png
My Project
Service References
DeepZoomServiceReference
configuration.svcinfo
configuration91.svcinfo
GenerateDeepZoomService.disco
GenerateDeepZoomService.wsdl
Reference.svcmap
ServiceReferences.ClientConfig
VBSL3DeepZoom.Web
App_Code
App_Data
Bin
DeepZoomTools.DLL
DeepZoomTools.DLL.refresh
ClientBin
GeneratedImages
GenerateDeepZoomService.svc
SourceImages
atom.png
background.jpg
cell.png
dna.png
Molecular.png
neutron.png
seed.png
wrap in bamboo.png
VBSL3HTMLBridge
VBSL3HTMLBridge
My Project
VBSL3HTMLBridge.Web
App_Data
ClientBin
VBSL3HTMLBridge.xap
My Project
Application.myapp
MyExtensions
Settings.settings
VBSL3Input
My Project
VBSL3LocalMessage
My Project
VBSL3MediaElement
ReadMe.mht
VBSL3MediaElement
My Project
VBSL3MediaElement.Web
App_Data
ClientBin
VBSL3MediaElement.xap
My Project
Application.myapp
MyExtensions
Settings.settings
VBSL3PixelShader
cyclewatery.ps
Humpback Whale.jpg
My Project
CSSL3Animation
Properties
CSSL3DeepZoom
CSSL3DeepZoom
images
home_hover.png
home_pressed.png
home_rest.png
Properties
Service References
DeepZoomServiceReference
configuration.svcinfo
configuration91.svcinfo
GenerateDeepZoomService.disco
GenerateDeepZoomService.wsdl
GenerateDeepZoomService1.wsdl
Reference.svcmap
ServiceReferences.ClientConfig
CSSL3DeepZoom.Web
App_Code
Bin
DeepZoomTools.DLL
DeepZoomTools.DLL.refresh
ClientBin
GeneratedImages
GenerateDeepZoomService.svc
SourceImages
atom.png
background.jpg
cell.png
dna.png
Molecular.png
neutron.png
seed.png
wrap in bamboo.png
ReadMe.mht
CSSL3HTMLBridge
CSSL3HTMLBridge
Properties
CSSL3HTMLBridge.Web
App_Data
ClientBin
CSSL3HTMLBridge.xap
Properties
CSSL3Input
Properties
========================================================================
    SILVERLIGHT APPLICATION : CSSL3Animation Project Overview
========================================================================

/////////////////////////////////////////////////////////////////////////////
Use:

This example illustrates how to play animation in Silverlight. Since animation
is a big topic, we only covers PointAnimation in this sample. For other animation
classes, the code should be similar.


/////////////////////////////////////////////////////////////////////////////
Prerequisites:

Silverlight 3 Tools for Visual Studio 2008 SP1
http://www.microsoft.com/downloads/details.aspx?familyid=9442b0f2-7465-417a-88f3-5e7b5409e9dd&displaylang=en

Silverilght 3 runtime:
http://silverlight.net/getstarted/


/////////////////////////////////////////////////////////////////////////////
Code Logic:

1. MainPage.xaml:

It is the container of the following UserControls:
BasicPointAnimation.xaml
AnimateDependencyProperty.xaml
Easing.xaml
CodeBehindCreation.xaml
UsingKeyFrames.xaml

2. BasicPointAnimation.xaml:

It shows how to write baisc PointAnimation for an EllipseGeometry. In the
MouseLeftButtonDown event of MyStackPanel, current mouse position is got and the
To property of PointAnimation object is updated. After that, call Begin() method
of the StoryBoard object to play animation.

3. MyEllipse.xaml:

This UserControl is used to wrap a EllipseGeometry. EllipseGeometry doesn't
expose any event for its Center change. So to get a notification after Center
change EllipseCenterProperty is added. A callback method is hooked so that whenever
the EllipseCenterProperty is changed we can synchronize the changed value with the
Center property of EllipseGeometry object, in which way to update UI.

4. AnimateDependencyProperty.xaml

This UserControl uses MyEllipse UserControl. The TargetProperty of the StoryBoard
in it is the EllipseCenterProperty of MyEllipse object. During the animation, the
EllipseCenterProperty will be changed and the callback method MyHandler() will be 
called, which in turn calls OnEllipseCenterChanged() method to trigger the 
EllipseCenterChanged event. The EllipseCenterChanged event is public so we can hook
event handler in AnimateDependencyProperty UserControl to get a notification for 
EllipseCenterProperty's change. In this sample, a Line object is updated in this
event handler to simulate an animation effect.

5. Easing.xaml

This UserControl demonstrates how to use built-in Ease classes and how to write a
custom Ease class. By inheriting EasingFunctionBase and override its EaseInCore()
method we can write our own Ease class.

6. CodeBehindCreation.xaml

This UserControl shows how to initialize a Storyboard in code behind. The final effect
is the same as BasicPointAnimation.xaml, which uses XAML to add Storyboard.

7. UsingKeyFrames.xaml

This UserControl shows how to create KeyFrames based animation in Silverlight.
In the sample SplineDoubleKeyFrame is used to specify each KeyFrame.


/////////////////////////////////////////////////////////////////////////////
References:

Animation
http://msdn.microsoft.com/en-us/library/cc189090(VS.95).aspx


/////////////////////////////////////////////////////////////////////////////

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)

Share

About the Author

Microsoft All-In-One Code Framework delineates the framework and skeleton of Microsoft development techniques through typical sample codes in three popular programming languages (Visual C#, VB.NET, Visual C++). Each sample is elaborately selected, composed, and documented to demonstrate one frequently-asked, tested or used coding scenario based on our support experience in MSDN newsgroups and forums. If you are a software developer, you can fill the skeleton with blood, muscle and soul. If you are a software tester or a support engineer like us, you may extend the sample codes a little to fit your specific test scenario or refer your customer to this project if the customer's question coincides with what we collected.
http://cfx.codeplex.com/

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.1411023.1 | Last Updated 12 Dec 2009
Article Copyright 2009 by All-In-One Code Framework
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid