Slow animation when collapsing Border on Map
Hi guys,
I have created mapoverlays which contain a border and grid. When a user clicks on a pushpin, I set the visibility of the border and then when a user clicks on it again, I collapse the visibility, but on my Lumia 920, I can actually see the border with controls fading away, its not disappearing immediately like for example on the location map pushpins of Nokia itself?
Is there any reason for that?
Re: Slow animation when collapsing Border on Map
Could you post some sample code of where you're changing the visibility of the elements?
Re: Slow animation when collapsing Border on Map
Grid grid = (Grid)sender;
var image = (Image) grid.Children[0];
var border = (Border)grid.Children[1];
var path = (Polygon)grid.Children[2];
if (border.Visibility == Visibility.Visible)
{
border.Visibility = Visibility.Collapsed;
path.Visibility = Visibility.Collapsed;
}
else
{
border.Visibility = Visibility.Visible;
path.Visibility = Visibility.Visible;
var cycleStationOnImage = (CycleStation)image.Tag;
myMap.SetView(cycleStationOnImage.GeoLocation,18,MapAnimationKind.Parabolic);
}
Re: Slow animation when collapsing Border on Map
[QUOTE=morfasie;913757]Grid grid = (Grid)sender;
var image = (Image) grid.Children[0];
var border = (Border)grid.Children[1];
var path = (Polygon)grid.Children[2];
if (border.Visibility == Visibility.Visible)
{
border.Visibility = Visibility.Collapsed;
path.Visibility = Visibility.Collapsed;
}
else
{
border.Visibility = Visibility.Visible;
path.Visibility = Visibility.Visible;
var cycleStationOnImage = (CycleStation)image.Tag;
myMap.SetView(cycleStationOnImage.GeoLocation,18,MapAnimationKind.Parabolic);
}[/QUOTE]
Can I get a snippet of your XAML too?
Re: Slow animation when collapsing Border on Map
[QUOTE] <phone:PanoramaItem Header="Locations" >
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="0,10,0,0">
<maps:Map x:Name="myMap"
PedestrianFeaturesEnabled="True"
LandmarksEnabled="True" Pitch="30" HorizontalAlignment="Left" Width="415" Margin="5,-48,0,0" ZoomLevel="10" Center="-27.46758,153.027892">
<my:MapExtensions.Children>
<my:UserLocationMarker x:Name="UserLocationMarker" Visibility="Collapsed"/>
</my:MapExtensions.Children>
</maps:Map>
</Grid>
</phone:PanoramaItem>[/QUOTE]
I create the pushpin and border etc in code
[QUOTE] // Actual Icon for PushPin
MapOverlay pin1 = new MapOverlay();
pin1.GeoCoordinate = station.GeoLocation;
pin1.PositionOrigin = new Point(0.5, 1);
Image img = new Image();
img.Source = new BitmapImage(new Uri(station.PushPinColor, UriKind.RelativeOrAbsolute));
// img.Tap += ManualPushPinTapEvent;
img.Tag = station;
img.Hold += img_Hold;
// Content Above Pin
Border border = new Border();
border.Visibility = Visibility.Collapsed;
border.BorderBrush = new SolidColorBrush(customBlue);
border.BorderThickness = new Thickness(5.0);
border.Opacity = opacityForContent;
// Add the controls to the grid
myGrid.Children.Add(img);
myGrid.Children.Add(border);
myGrid.Children.Add(polygon);
pin1.Content = myGrid;
markerLayer.Add(pin1);
[/QUOTE]
Left out creating of all grid and polygon etc
Re: Slow animation when collapsing Border on Map
I wasn't able to re-create the issue so I'll just give some general advice and/or things to try...
A) Try a less complex 'pin' and see if the issues persists - just have a plain Grid with a background colour, make sure Opacity is set to 1, then use the Tap event to hide and show the grid.
B) When running code on your device (Lumia 920), try running the app in Release mode (ie. no debugger attached).
Also, I notice from the XAML code that your Map is inside a Panorama. [URL="http://stackoverflow.com/questions/4199232/map-inside-panorama-moves-the-panorama-when-panning-map"]It's not good practice to use a Map inside a panorama[/URL] as when you swipe-left, the expectation is that Panorama will move, not the Map.
Re: Slow animation when collapsing Border on Map
[QUOTE=theothernt;913970]I wasn't able to re-create the issue so I'll just give some general advice and/or things to try...
A) Try a less complex 'pin' and see if the issues persists - just have a plain Grid with a background colour, make sure Opacity is set to 1, then use the Tap event to hide and show the grid.
B) When running code on your device (Lumia 920), try running the app in Release mode (ie. no debugger attached).
Also, I notice from the XAML code that your Map is inside a Panorama. [URL="http://stackoverflow.com/questions/4199232/map-inside-panorama-moves-the-panorama-when-panning-map"]It's not good practice to use a Map inside a panorama[/URL] as when you swipe-left, the expectation is that Panorama will move, not the Map.[/QUOTE]
Thanks, will try and let you know