This question is locked. New answers and comments are not allowed.
I'm trying to traverse through each item on the map randomly when the application is in idle. I did this by setting up a custom attach property and I would bind my storyboard animation to it. Inside the attach property, I would set the center/zoomlevel everytime the property value changes.
Example of setting the center value of the map.
Storyboard
Snippet of the output:
Old Value: 47.1004638671875, -121.004898071289
New Value: 47.4084663391113, -121.796180725098
Changed Value: 47.4084663391113, -121.796180725098 -RIGHT
Old Value: 47.4084663391113, -121.796180725098
New Value: 47.5841407775879, -122.247497558594
Changed Value: 47.5841407775879, -122.247497558594 -RIGHT
Old Value: 47.5841407775879, -122.247497558594
New Value: 47.6220588684082, -122.344917297363
Changed Value: 47.6220588684082, -122.344917297363 -RIGHT
Old Value: 47.6220588684082, -60.4470691680906
New Value: 47.2447166442871, -110.667938232422
Changed Value: 47.2447166442871, -23.9447751045224 -WRONG
Old Value: 47.2447166442871, -23.9447751045224
New Value: 46.643497467041, -92.0630416870117
Changed Value: 51.8482260475886, -17.861059427261 - WRONG
I did not touch or pan the map while the map was animating.
I assumed that it could be a timing issue, especially when it is constantly setting the center property on every animation value change, so I tried and set the Map center value directly and see what's the value is after the CenterChanged event fired, but just as expected, the center value is off, usually the longitude that is wrong.
For the purpose of what I'm trying to do, this causes the map to zoom in randomly for example in the middle of the ocean instead of the item I have on the map.
Any help would be appreciated.
Thank You,
Example of setting the center value of the map.
private static void OnMapCenterPositionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var mapCtrl = (RadMap)d;
var p = (Point)(e.NewValue);
Debug.WriteLine("Old Value: " + mapCtrl.Center.Latitude + ", " + mapCtrl.Center.Longitude);
var newLocation = new Location(p.X, p.Y);
mapCtrl.Center = newLocation;
Debug.WriteLine("New Value: " + p.X + ", " + p.Y);
Debug.WriteLine("Changed Value: " + mapCtrl.Center.Latitude + ", " + mapCtrl.Center.Longitude);
}
Storyboard
<
Storyboard
x:Name
=
"TraverseStoryboard"
Completed
=
"TraverseStoryboardCompleted"
>
<
DoubleAnimationUsingKeyFrames
x:Name
=
"ZoomAnimation"
AutoReverse
=
"True"
Storyboard.TargetName
=
"ProductMaps"
>
<
EasingDoubleKeyFrame
KeyTime
=
"0:0:0"
Value
=
"3.0"
>
<
EasingDoubleKeyFrame.EasingFunction
>
<
SineEase
EasingMode
=
"EaseOut"
/>
</
EasingDoubleKeyFrame.EasingFunction
>
</
EasingDoubleKeyFrame
>
<
EasingDoubleKeyFrame
KeyTime
=
"0:0:5"
Value
=
"17.0"
>
<
EasingDoubleKeyFrame.EasingFunction
>
<
SineEase
EasingMode
=
"EaseOut"
/>
</
EasingDoubleKeyFrame.EasingFunction
>
</
EasingDoubleKeyFrame
>
<
EasingDoubleKeyFrame
KeyTime
=
"0:0:10"
Value
=
"17"
/>
</
DoubleAnimationUsingKeyFrames
>
<
PointAnimationUsingKeyFrames
x:Name
=
"CenterPointAnimation"
Storyboard.TargetName
=
"ProductMaps"
>
<
EasingPointKeyFrame
x:Name
=
"CenterPointKeyFrame"
KeyTime
=
"0:0:2"
>
<
EasingPointKeyFrame.EasingFunction
>
<
SineEase
EasingMode
=
"EaseOut"
/>
</
EasingPointKeyFrame.EasingFunction
>
</
EasingPointKeyFrame
>
</
PointAnimationUsingKeyFrames
>
</
Storyboard
>
Snippet of the output:
Old Value: 47.1004638671875, -121.004898071289
New Value: 47.4084663391113, -121.796180725098
Changed Value: 47.4084663391113, -121.796180725098 -RIGHT
Old Value: 47.4084663391113, -121.796180725098
New Value: 47.5841407775879, -122.247497558594
Changed Value: 47.5841407775879, -122.247497558594 -RIGHT
Old Value: 47.5841407775879, -122.247497558594
New Value: 47.6220588684082, -122.344917297363
Changed Value: 47.6220588684082, -122.344917297363 -RIGHT
Old Value: 47.6220588684082, -60.4470691680906
New Value: 47.2447166442871, -110.667938232422
Changed Value: 47.2447166442871, -23.9447751045224 -WRONG
Old Value: 47.2447166442871, -23.9447751045224
New Value: 46.643497467041, -92.0630416870117
Changed Value: 51.8482260475886, -17.861059427261 - WRONG
I did not touch or pan the map while the map was animating.
I assumed that it could be a timing issue, especially when it is constantly setting the center property on every animation value change, so I tried and set the Map center value directly and see what's the value is after the CenterChanged event fired, but just as expected, the center value is off, usually the longitude that is wrong.
For the purpose of what I'm trying to do, this causes the map to zoom in randomly for example in the middle of the ocean instead of the item I have on the map.
Any help would be appreciated.
Thank You,