PageRenderTime 45ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/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. <UserControl x:Class="VBSL3Animation.AnimateDependencyProperty"
  19. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  20. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  21. xmlns:c="clr-namespace:VBSL3Animation"
  22. Width="400" Height="300">
  23. <UserControl.Resources>
  24. <Storyboard x:Name="MyAnimationStoryboard">
  25. <PointAnimation x:Name="MyAnimation"
  26. Duration="0:0:2"
  27. Storyboard.TargetProperty="EllipseCenter"
  28. Storyboard.TargetName="MyAnimatedEllipseGeometry"
  29. ></PointAnimation>
  30. </Storyboard>
  31. </UserControl.Resources>
  32. <Grid x:Name="LayoutRoot">
  33. <Grid.RowDefinitions>
  34. <RowDefinition Height="1*"></RowDefinition>
  35. <RowDefinition Height="9*"></RowDefinition>
  36. </Grid.RowDefinitions>
  37. <StackPanel Grid.Row="0">
  38. <TextBlock Text="Please click mouse in the black area."></TextBlock>
  39. </StackPanel>
  40. <StackPanel x:Name="MyStackPanel" MouseLeftButtonDown="MyStackPanel_MouseLeftButtonDown" Background="Black" Grid.Row="1">
  41. <Canvas>
  42. <Line x:Name="MyLine" Fill="Red" Stroke="Red" Visibility="Collapsed" StrokeThickness="5" Canvas.ZIndex="1"></Line>
  43. <c:MyEllipse x:Name="MyAnimatedEllipseGeometry" EllipseCenterChanged="MyAnimatedEllipseGeometry_EllipseCenterChanged"></c:MyEllipse>
  44. </Canvas>
  45. </StackPanel>
  46. </Grid>
  47. </UserControl>