PageRenderTime 7ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

/Visual Studio 2008/VBSL3Animation/AnimateDependencyProperty.xaml

#
XAML | 48 lines | 30 code | 1 blank | 17 comment | 0 complexity | 9d6b36db9de078e8b31a3a26e7ad8f20 MD5 | raw file
 1<!--/****************************** Module Header ******************************\
 2* Module Name:  AnimateDependencyProperty.xaml
 3* Project:      VBSL3Animation
 4* Copyright (c) Microsoft Corporation.
 5* 
 6* This module shows how to catch custom event of MyEllipse object and in the
 7* relevant event handler, it creates animation effect for the Line object by
 8* syncronizing its endpoints with the latest mouse click point and current position
 9* of MyEllipse object.
10* 
11* This source is subject to the Microsoft Public License.
12* See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
13* All other rights reserved.
14* 
15* History:
16* * 9/8/2009 05:00 PM Allen Chen Created
17\***************************************************************************/-->
18    
19<UserControl x:Class="VBSL3Animation.AnimateDependencyProperty"
20    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
21    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
22    xmlns:c="clr-namespace:VBSL3Animation"
23    Width="400" Height="300">
24    <UserControl.Resources>
25        <Storyboard x:Name="MyAnimationStoryboard">
26            <PointAnimation x:Name="MyAnimation"
27                            Duration="0:0:2" 
28                            Storyboard.TargetProperty="EllipseCenter"
29                            Storyboard.TargetName="MyAnimatedEllipseGeometry"
30></PointAnimation>
31        </Storyboard>
32    </UserControl.Resources>
33    <Grid x:Name="LayoutRoot">
34        <Grid.RowDefinitions>
35            <RowDefinition Height="1*"></RowDefinition>
36            <RowDefinition Height="9*"></RowDefinition>
37        </Grid.RowDefinitions>
38        <StackPanel Grid.Row="0">
39            <TextBlock Text="Please click mouse in the black area."></TextBlock>
40        </StackPanel>
41        <StackPanel x:Name="MyStackPanel" MouseLeftButtonDown="MyStackPanel_MouseLeftButtonDown" Background="Black"  Grid.Row="1">
42            <Canvas>
43                <Line x:Name="MyLine" Fill="Red"  Stroke="Red"  Visibility="Collapsed" StrokeThickness="5" Canvas.ZIndex="1"></Line>
44                <c:MyEllipse x:Name="MyAnimatedEllipseGeometry" EllipseCenterChanged="MyAnimatedEllipseGeometry_EllipseCenterChanged"></c:MyEllipse>
45            </Canvas>
46        </StackPanel>
47    </Grid>
48</UserControl>