I have a bing map with this clip:
<my:Map.Clip>
<RectangleGeometry RadiusX="15" RadiusY="15" Rect="0,0,450,250" />
</my:Map.Clip>
The map is in a ScrollViewer somewhere at the bottom and only half of it is visible.
The problem is that when I scroll up to reveal the entire map, the part of the map that was not visible is now black.
This problem doesn't occur when I don't have a clip on my map. It's rendered correctly.
So is this a bug in the control or am I doing something wrong?
Anyone had this issue before?
Update: I have made a small sample project to demonstrate this: link. Also, while doing this I also noticed that the problem only occurs when the map control is inside a grid. If I place it straight in the ScrollViewer it works just fine.
Update: Setting a fixed height for the grid row doesn't help. Also, putting the grid + map inside a stackpanel and then inside a scrollviewer doesn't work. Any of you found anything to fix this?
You should not include a Bing Map control within a ScrollViewer or Pivot, Panorama or any other control that captures pan / scroll gestures. This will lead to a very poor user-experience because the user will not know whether the gesture is going to be captured by the map or the hosting control. What I think is happening is that when you scroll, you are not scrolling the ScrollViewer, rather, you are panning the map.
On looking at your code, this has nothing to do with the map capturing the gestures rather than the ScrollViewer, the map maintains its original clip regardless of where the user initiates their scroll.
The reason for this behaviour is that the Map Silverlight control (and the WebBrowser control too) include a native rendering component. For example the WebBrowser has a TileHost as described in this article. For this reason, various Silverlight framework effects cannot be applied to the map, for example RenderTransforms.
To solve you issue you are going to have to force the map to re-render itself when the user scrolls. To do this, I locate the ScrollViewer vertical ScrollBar using Linq-to-VisualTree, then as the user scrolls apply a very very small zoom to the map. This will cause it to re-render:
using System.Linq;
using System.Windows;
using System.Windows.Controls.Primitives;
using LinqToVisualTree;
using Microsoft.Phone.Controls;
namespace BingMapClipIssueDemo
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(ContentPanel_Loaded);
}
void ContentPanel_Loaded(object sender, RoutedEventArgs e)
{
ScrollBar verticalScroll = ContentPanel.Descendants<ScrollBar>()
.Cast<ScrollBar>()
.Where(sb => sb.Orientation == System.Windows.Controls.Orientation.Vertical)
.Single();
verticalScroll.ValueChanged += (s, e2) =>
{
map.ZoomLevel = map.ZoomLevel + 0.00001;
};
}
}
}
Just drop the code above into your example and it should work.
Try using the Static Bing Maps API instead of the Bing Map control if you don't want the user to interact with the Map
http://msdn.microsoft.com/en-us/library/ff701724.aspx
Related
I am trying to implement swipe actions on ListView for each element. Whole view is AbsoluteLayout, with two GridLayouts: one acting as "foreground"(list element) and other as "background" (swipe actions). I want them both to have equal height of "foreground" (which is dynamic and differs for every list element).
I succesfully implemented this on Android - I call a method on layoutChanged event
onLayoutChanged(args: EventData) {
const foregroundNotificationTemplate = (<AbsoluteLayout>(args.object)).getChildAt(1);
const backgroundButtons = (<AbsoluteLayout>args.object).getChildAt(0);
backgroundButtons.height = foregroundNotificationTemplate.getActualSize().height;
}
This unfortunatelly is not working on iOS. I tried to access Frame and UiView, but with no success - it has height of background content.
Demo presenting the problem on Nativescript Playground:
https://play.nativescript.org/?template=play-ng&id=4LRwDC
You don't necessarily have to use AbsoluteLayout as you are animating the position with translate which is possible with any layout. So using GridLayout instead of AbsoluteLayout should solve your problem on both platforms and you may also get rid layoutChanged event for measuring height.
Also note that your ListView item template can not be dynamic, you should not use ngIf or anything that would alter the structure of the list item, use multiple templates instead.
For anyone looking for working solution, thats what Manoj proposed: https://play.nativescript.org/?template=play-ng&id=yXggcv
How do you guys handle the safe area problem for ListViews with Xamarin.Forms? Just setting the safe area as margin on the whole ListView looks ugly AF. So I search for something like a custom renderer to make the ListView as equal als possible to the UITableView in the iPhone X. My current solution bringt the ViewCells in the correct position but the Seperator is going off screen and the ShortGroup index is behind the Notch in some rotations. Beside from that, my current solution is way to much work to implement it in every project (because I use a CustomViewCell class as Workaround).
So how to implement a custom renderer for this problem? All of my current implementations seems not to work properly. And I guess waiting for Xamarin to fix this is not an option (because MasterDetail pages still not work on iOS SplitView and this was reported back in 2015 and is just ignored by Xamarin...).
Edit: The problem with the ListView in Xamarin.Forms did only occur if the ListView control is not the root of the ContentPage. In my case it is inside a Grid because I want a SearchBar too on this side. In this case the content of the ListView (and the ShortGroup index) gets cut off by the iPhone X rounded corners and the notch. It looks really ugly and I guess it is a very common way to have a SearchBar and a ListView on one side. Here is a repository of a project which has a first workaround (the ShortGroup index still has the problem there and also the separator runs outside of the visible area while it normally would stop before that): https://github.com/Sebastian1989101/OpenGeoDB-App
I was looking at this example of openLayers ( http://openlayers.org/en/v3.14.1/examples/custom-interactions.html?q=custom ) and I was wondering how can I load a small image like the one in the example on mouse down on the map? I tried several things but couldn't figure it out. Any ideas?
Thanks!
The example you link to uses custom interactions to drag existing features around the map - this code is very useful and I used it to work out how to drag markers around my map.
However, there is a simpler way to add the markers in the first place, which is to use the map's singleclick event handler:
map.on("singleclick", function(event) {
// Add icon here...
})
I've put a complete example here, showing how I did it:
http://www.freytag.org.uk/pages/2016/03/06/openlayers-addfeature.html
Once you've got that working, you can use the custom interactions in the OL3 example to then drag those markers around the map.
I'm developing an iOS application using Adobe Flash.
It is working fine, except a tile list, that shows a scrollbar and it needs to be dragged to scroll the tile list and show all its content.
Is there a way to make it scroll by just touching and dragging it anywhere?
thanks.
If you are using Flex, this will work.
Don't set a height (or width, depending on your needs) and wrap it in a Scroller object. I'm not sure if a TileList is a valid ViewPort or not, so you may have to do one further level of abstraction and wrap the TileList in a generic Group object. This will provide a close-to-native scroll functionality to the object within the Scroller.
Example:
<s:Scroller width="100%" height="100%">
<s:TileList>
</s:TileList>
</s:Scroller>
I'm having some trouble finding documentation on CLOSING a blackberry map.
My map opens, albeit with some odd marker behavior, but when you close the map it displays a clear screen.
The invoke code is quite simple, as the map request calls a new controller and within the constructor is this:
String document = "<location-document>... etc";
Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments( MapsArguments.ARG_LOCATION_DOCUMENT, document));
I tried to add a close line
public boolean onClose() {
UiApplication.getUiApplication().popScreen(this);
return true;
}
but this is not being applied to the map itself, but the page the map opened into. That's logical, I guess.
Maybe I'm going about this all wrong. I don't know of how to open a map another way, or if there is a way to have the close button close the map AND the containing screen.
Any help is appreciated.
I solved this with a simple one line function that fixed this problem.
public void onExposed()
{
UiApplication.getUiApplication().popScreen(this);
}
Adding that to the map controller closes the map application when the user clicks the back button. Simple as that.