How to animate current location pushpin? RRS feed

  • General discussion

  • I have a custom pushpin whose template is like below

            <ControlTemplate x:Key="PushpinControlTemplate1" TargetType="maps:Pushpin">
                <Grid HorizontalAlignment="Left" Height="22" VerticalAlignment="Top" Width="22">
                    <Ellipse x:Name="ellipse" Fill="#7FF4F4F5" HorizontalAlignment="Left" Height="100" Stroke="#FF0017FF" VerticalAlignment="Top" Width="100" StrokeThickness="4" RenderTransformOrigin="0.5,0.5" Margin="0,0,-78,-78">
                    <Ellipse Fill="#FFFF2300" HorizontalAlignment="Left" Height="20" Stroke="White" StrokeThickness="2" VerticalAlignment="Top" Width="20" Margin="40,40,-38,-38"/>

    I have defined the same within maps like below

    <maps:Pushpin x:Name="AnimPushPin" Template="{StaticResource PushpinControlTemplate1}">

    I have a storryboard in which the outer ellipse scale for every 2 seconds in map resources.

                            <Storyboard x:Name="Storyboard1" RepeatBehavior="Forever" AutoReverse="True">
                                <DoubleAnimation Duration="0:0:2" To="0.25" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="ellipse" d:IsOptimized="True"/>
                                <DoubleAnimation Duration="0:0:2" To="0.25" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="ellipse" d:IsOptimized="True"/>

    Now after getting my current location how can i animate the plotted pushpin?


    Friday, March 15, 2013 7:39 PM

All replies

  • You're going to need to set the Storyboard.TargetName on your animations, otherwise they won't know what to update.  I haven't done this specifically with a pushpin, but with other UIElements.

    Once your geolocater gets your current position, you should be able to do something like Storyboard1.Begin().  If you set your target name properly, I believe it should work.  I'd be very interested to know if you get this working, I'd like to do something similar.

    Friday, March 22, 2013 3:04 PM