Bing Maps for Windows UWP apps


Dashed line for polygons


Hi!
I'm developing an application with bing maps where i'm drawing polygons on the map. Im using the class 'MapPolyline' for drawing lines between coordinates, and I can't seem to find anyway to make them dashed with the .NET library for metro apps.
Can anyone help me with this? 
There is unfortunately no way to have dashed lines with the built-in class. You may be able to put one together manually using the built-in line and positioning it OnViewChange using TryLocationToPixel per point though performance will most likely take
a hit.
I can't say if this will be supported in future versions of this control or not. There is a workaround but it's a decent amount of work. The work around consists of inserting a canvas into a MapLayer and then drawing standard Line class which supports brushes,
not MapPolylines on the canvas. This requires using the ViewChange event on the map to update the position of the line on the canvas/map. To update the position simply take the latlong coordinates for the line and convert them to pixels using the Map's TryLocationsToPixels
method. This will create a list of pixel coordinates which can be used to set the position of the line.
I have a code sample online that does a lot of this, although positioning an image rather than a line. You can find the sample here:
http://code.msdn.microsoft.com/Binding-and-Image-to-a-01a56e48/sourcecode?fileId=107334&pathId=1304247442
http://rbrundritt.wordpress.com
I've thrown together a code sample for creating custom MapPolyline's that support dashes and Brushes:
http://code.msdn.microsoft.com/Custom-MapPolylines-in-860a65f3http://rbrundritt.wordpress.com
There is unfortunately no way to have dashed lines with the built-in class. You may be able to put one together manually using the built-in line and positioning it OnViewChange using TryLocationToPixel per point though performance will most likely take
a hit.
Hmm Ok..
Is it possible to reference some library that will make them dashed? I know that PresentationFramework.dll in .NET 4.5 includes some functions for this. But its not possible to import, right?
In Ricky's response he states: "There is unfortunately no way to have dashed lines with the built-in class."
Will this always be the case?
Given that the Bing Maps AJAX, WPF, Silver light and Phone API's can have dashed lines on poly-lines, is this something that will be addressed in a
future update to the API, or is there some inherent reason why this will never be possible?
I can't say if this will be supported in future versions of this control or not. There is a workaround but it's a decent amount of work. The work around consists of inserting a canvas into a MapLayer and then drawing standard Line class which supports brushes,
not MapPolylines on the canvas. This requires using the ViewChange event on the map to update the position of the line on the canvas/map. To update the position simply take the latlong coordinates for the line and convert them to pixels using the Map's TryLocationsToPixels
method. This will create a list of pixel coordinates which can be used to set the position of the line.
I have a code sample online that does a lot of this, although positioning an image rather than a line. You can find the sample here:
http://code.msdn.microsoft.com/Binding-and-Image-to-a-01a56e48/sourcecode?fileId=107334&pathId=1304247442
http://rbrundritt.wordpress.com
I've thrown together a code sample for creating custom MapPolyline's that support dashes and Brushes:
http://code.msdn.microsoft.com/Custom-MapPolylines-in-860a65f3http://rbrundritt.wordpress.com

Related Links

How to check Permission for Location Tracking?
MapManager - extends Bing Maps for Metro with tappable annotations (pushpins) and callouts
Is it possible to remove copyright names at bottom of map?
How to use the responsed xml information into my app?
Resetting or Removing some or all MapUIElementCollection elements from Map.
How to lock navigation on Bing Maps Metro Style?
Tile X,Y position vs quadkey
Calulate Distances with Bing ???
Set transparence for a polygon?
Best way to scroll the map by a given amount
Draw image on map?
Any examples of using Bing REST services in a C# Metro App?
[Bingmaps] [Javascript\HTML] How to disable infinite horizontal scrolling?
How to overlay a polygon on Bing basemap ?
Map Children Image size very large?
SetPositionRectangle On Metro Bing Control

Categories

MSDN
Visual Studio Languages
Visual Studio Development
Windows Phone Dev Center
.NET Framework
JScript and Scripting
Internet Explorer Deve...
Learning
SQL Server (Pre-release)
Windows Forms
Development
Silverlight
Expression
Archived Forums W
Archived Forums X-Z
Windows Phone Preview ...
Visual Studio Diagnost...
Payouts and Reporting
Windows App Studio Beta
Media Foundation Devel...
Microsoft Message Queu...
Windows Desktop Pro-Au...
Windows Desktop Winsoc...
Development with the W...
Word for Developers
SharePoint 2013 - Setu...
SharePoint Legacy Vers...
Azure Media Services
Azure Automation
Azure Stream Analytics
StorSimple
Azure Logic Apps
Azure Stack
Azure Data Lake Analyt...
Azure Blockchain
Azure Database for MySQL
Azure Time Series Insi...
Common Language Runtim...
Team Foundation Server...
Team Foundation Server...
Team Foundation Server...
Team Foundation Server...
Software Modeling Tools
BizTalk Server Adapter...
Commerce Server 2009
WCF Data Services
Partnering with Microsoft
SyncFx - General [Read...
Microsoft Robotics - D...
.NET Compact Framework
Transact-SQL
SQL Server Replication
SQL Server Search
SQL Server PowerPivot ...
Standard 2009: Tools
Standard 2009: Misc
Windows Embedded 8.1 I...
Windows Embedded Compa...
SQL Server 2012 PowerP...
Windows Forms Sample A...
Windows Live  Spaces: ...
MSDN, TechNet and Expr...
WebsitePanel - Support
WebsitePanel - Develop...
Getting Started with S...
Silverlight 4
Programming Silverligh...
Report a Silverlight Bug
MVVM / ViewModel Patte...
Expression Studio with...
Connected Services Fra...
Retired SharePoint Acc...
.NET Framework 4 setup...
.NET Framework 4: Wind...
Acropolis
ADO.NET Entity Framewo...
Audio API and Programm...
Core Coding Experience...
Developer Documentatio...
Dynamic Languages on .NET
Game Technologies: Aud...
General Troubleshootin...
Hobbyist Zone
Git, Mercurial and Dro...
LINQ to SQL (Pre-Release)
Microsoft adCenter: De...
Microsoft ESP Platform...
Multimap API Developme...
Office Live Small Busi...
Parallel Computing Pla...
Performance Counters f...
Pex and Moles PowerTool
Phoenix
Popfly Bugs and Sugges...
Popfly Explorer
Project Codename:  Jasper
Parallel Programming w...
Search Server: Federation
Silverlight (formerly ...
SQL Server 2014 Self-S...
SQL Server 2014 Databa...
SQL Server 2014 Analys...
SQL Server 2014 Integr...
TFS Deployment to Azure
Visual Studio 2008 (Pr...
Visual Studio Guidance...
Visual Studio Lab Mana...
Visual Studio Performa...
Windows Phone Preview ...
Windows Containers
Microsoft R Server
Microsoft R Open

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile