Click here to Skip to main content
15,861,172 members
Articles / Programming Languages / C#

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

Rate me:
Please Sign up or sign in to vote.
5.00/5 (26 votes)
12 Dec 2009Ms-PL5 min read 54.9K   2.2K   56  
This article introduces several Silverlight samples in the All-In-One Framework.
'***************************** Module Header ******************************\
'* Module Name:	AnimateDependencyProperty.xaml.vb
'* Project:		VBSL3Animation
'* Copyright (c) Microsoft Corporation.
'* 
'* This module shows how to catch custom event of MyEllipse object and in the
'* relevant event handler, it creates animation effect for the Line object by
'* syncronizing its endpoints with the latest mouse click point and current position
'* of MyEllipse object.
'* 
'* This source is subject to the Microsoft Public License.
'* See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
'* All other rights reserved.
'* 
'* History:
'* * 9/8/2009 05:00 PM Allen Chen Created
'\**************************************************************************

Partial Public Class AnimateDependencyProperty
    Inherits UserControl

    Private _currenttargetpoint As Point

    Public Sub New()
        InitializeComponent()

    End Sub

    Private Sub MyStackPanel_MouseLeftButtonDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
        _currenttargetpoint = e.GetPosition(Me.MyStackPanel)
        Me.MyAnimation.To = _currenttargetpoint
        Me.MyAnimationStoryboard.Begin()

    End Sub

    ''' <summary>
    ''' The following method syncronize MyLine's endpoints with the latest mouse
    ''' click point and current position of MyEllipse object. Therefore, an animation
    ''' is created for MyLine.
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    Private Sub MyAnimatedEllipseGeometry_EllipseCenterChanged(ByVal sender As DependencyObject, ByVal e As DependencyPropertyChangedEventArgs)
        Me.MyLine.Visibility = Visibility.Visible
        Me.MyLine.X1 = Me.MyAnimatedEllipseGeometry.EllipseCenter.X
        Me.MyLine.Y1 = Me.MyAnimatedEllipseGeometry.EllipseCenter.Y
        Me.MyLine.X2 = Me._currenttargetpoint.X
        Me.MyLine.Y2 = Me._currenttargetpoint.Y

    End Sub
End Class

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)


Written By
China China
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/

Comments and Discussions