I have created a Silverlight Application project using the Bing Maps Silverlight Control and it works well.
Now I want to use a frame control in other WPF Application project to show the map. So I want to put the main page of the Silverlight project into the frame. I tried to add reference to the WPF project, but there appeared an error. And using Bing Maps SOAP Services in WPF project doesn't meet requirements, so I must use the Bing Maps Silverlight Control.
I really don't know how to solve the problem. I'll be glad to know any ways to use Bing Maps Silverlight Control in a WPF project.
Thanks!
Microsoft has recently published (23.08.2011) a beta version of a WPF control for Bing Maps. The API is quite the same as Bing Maps Control for Silverlight API so a significant piece of code written for Silverlight version should also work with the WPF control. Here's a blog entry with details: http://www.bing.com/community/site_blogs/b/maps/archive/2011/08/23/announcing-the-bing-maps-wpf-control.aspx
If you cannot use a Bing Map control for WPF (e.g. see: http://www.codeproject.com/KB/IP/BingMapsWebServiceExample.aspx), you could try to load the webpage that hosts the silverlight control inside your WPF app. You could achieve this by using the WebBrowser control or some similar method, and setting the URL to your silverlight page.
Cheers,
G.
Related
I want to implement an ArcGIS web map in my winform C# application. I have found a bunch of resources for doing this in a WPF application, but nothing for the winform platform. I have an API-Key from ArcGIS and have already made a webmap.
Does anyone know if this is even possible or do I need to use WPF to do this? I have tried the GMap open source, and it does support some maps from ArcGIS, but I have not figured out how to add "custom" webmaps from a link. I would also need to add credentials to my example.
F.eks
Map.MapProvider = GMap.NET.MapProviders.ArcGIS_World_Street_MapProvider.Instance;
Edit,
Sadly it seems that the best solution is to implement a wpf controller into the winform application.
You can definitely use the Esri ArcGIS Runtime SDK to do this. Yes it is a WPF control, but that's no problem. You'll need to use the ElementHost to host WPF content inside the WinForms view, and this is fully supported but the runtime. Just be aware that WinForms uses software rendering, so you don't get as good performance as you would with a pure WPF, UWP or WinUI3 window.
So you'll just follow all the doc found on how to do it in WPF, then render that part of the view inside the ElementHost of your WinForms app.
WinForms Element host doc: https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.integration.elementhost?view=net-5.0
Conceptual doc/examples of hosting WPF in WinForms:
https://learn.microsoft.com/en-us/dotnet/desktop/winforms/advanced/walkthrough-creating-new-wpf-content-on-windows-forms-at-design-time?view=netframeworkdesktop-4.8
https://learn.microsoft.com/en-us/dotnet/desktop/wpf/advanced/walkthrough-hosting-a-wpf-composite-control-in-windows-forms?view=netframeworkdesktop-4.8
https://learn.microsoft.com/en-us/dotnet/desktop/wpf/advanced/walkthrough-hosting-a-3-d-wpf-composite-control-in-windows-forms?view=netframeworkdesktop-4.8
/Morten Nielsen - Dev Lead (ArcGIS Runtime SDK for .NET)
If I understand correctly you want a world map, I don't know what you're planning on doing with it so if you just want to display a world map then I found a YouTube tutorial about this that might help,
https://www.youtube.com/watch?v=TxSJJfaAzKg
If you want an interactive map and arcgis does that for you then you can emulate a WPF control inside a winforms application,
https://www.youtube.com/watch?v=VfpzVDAJ1fE
Sorry if I'm only showing YouTube videos as sources instead of actual documentation, but at least it gets the job done.
I have followed this article here:
http://blogs.msdn.com/b/eternalcoding/archive/2013/10/29/how-to-use-specific-winrt-api-from-desktop-apps-capturing-a-photo-using-your-webcam-into-a-wpf-app.aspx
And it all works great... but how do I get a preview in WPF?
The XAML "CaptureElement" control is not available in WPF. Is there any other way I can get a preview using the MediaCapture API?
Why would Microsoft not make this control Available?
Late reply, but in case that helps folks in the future: previewing MediaCapture in WPF is difficult but possible. Here is some code sample:
https://github.com/mmaitre314/MediaCaptureWPF
After investigating further it seems impossible to get this to work with the XAML Capture Element or any other XAML element in WPF.
I decided to port my WPF app to a Win8 application. I kept the existing back end code and referenced it using a Brokered WinRT Component. An excellent tutorial can be found here: http://devhawk.net/2014/04/25/brokered-winrt-components-step-one/ on how to create a WinRT brokered component.
Keep in mind that the app must be sideloaded and will not work for apps that you want to publish to the store.
You will have to rig up a mechanism to display the converted BitmapImage yourself, e.g., either in an Image control or as an ImageBrush on some surface. To the best of my knowledge, WinRT controls cannot be hosted in WPF.
CaptureElement was presumably not ported to WPF because it depends on WinRT APIs, and it makes little sense to introduce a dependency into WPF for an API that is only available on Windows 8+, and which is only officially supported in Windows Store apps.
I want to use the Bing map WPF control and I'm wondering if it is possible to set our own "image source".
Basically I'd like to use the control to provide deep zoom functionality for various images that would be loaded by my application.
I know that it's possible with Google maps (as shown here: http://blog.mikecouturier.com/2011/07/create-zoomable-images-using-google.html#maps_code_tilesgen)
but I was wondering we can do something similar with Bing maps?
P.S.: I would prefer using Bing because Microsoft provides a native WPF control, something that Google doesn't.
In order to add a custom map (or image) tile provider you would have to implement a TileSource and override its GetUri method to provide the URI of an image tile.
See Adding Tile Overlays to the Map for the details. The code sample there is not that great, since some things they do in code could better be done in XAML, but it is a starting point.
Note however that even if you don't use Bing Maps content, using the WPF control forces you to use a Bing Maps API Key. The control authenticates your key at the Bing Maps service provider, which will require an internet connection. Hence your image display application won't run in an offline environment, or to be more precise, it will run but display an ugly error message in the center of the control area.
You certainly can and it's incredibly easy to do in Bing Maps. Microsoft has developed a tool called MapCruncher that cuts a supplied image into tiles with the structure expected by Bing Maps. This is really important because, although Bing Maps and Google share the same tile structure, Bing Maps uses something called a quadkey to define each tile (meaning, the z-x-y of the tile).
Note: it's also possible to load tiles made for Google Maps in Bing Maps. You just need to tweak the tile source.
Anyway, better shown than said.
Here's a really detailed tutorial by the Microsoft Research team on using MapCruncher:
http://research.microsoft.com/en-us/um/redmond/projects/mapcruncher/tutorial/version3.0docs/index.htm
I was trying to create an app using Bing Map. in which i need to add two reference libraries
Microsoft.Maps.MapControl.Common.dll
Microsoft.Maps.MapControl.dll
I followed the tutorial from : http://www.codeguru.com/csharp/csharp/cs_misc/article.php/c18305__1/Working-with-Bing-Maps-in-Silverlight-and-Windows-Phone-7-Applications.htm
But when i installed BingMapAppSDK from Bing Maps it didn't have these api.
It does have libraries
Microsoft.Maps.Core;
Microsoft.Maps.MapControl;
Microsoft.Maps.MapControl.Types;
Microsoft.Maps.Plugins;
But not the above ones.. Due to this i am not able to use Bing Maps.
I am using Visual Studio 2010 and creating Silverlight app and Silverlight 5 is installed.
Please suggest.
You have To add a Service Reference.
1 . Right click on "reference" and then Add Service Reference.
then copy one of the four links from here which you want to use.
http://msdn.microsoft.com/en-us/library/cc966738.aspx
Click on go .
Name it according to you .
Now try to add namespaces
like
using ProjectName.GeocodeService;
using ProjectName.ImageryService;
Hope This helps.
There are different Bing Maps SDKs for different platforms although, confusingly, they do share rather similar namespaces. It's really unclear from your post which platform you're trying to target...
To develop a Silverlight Bing Maps application, you need the Bing Maps Silverlight control SDK, available from http://www.microsoft.com/download/en/details.aspx?id=2949
To develop a Windows Phone 7 Bing Maps application, you need the Windows Phone 7 SDK, http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=27570
To develop a "Bing Maps App" (note the quotation marks), which is a special kind of Bing Maps application that is hosted by Microsoft on the bing.com/maps site, you need the Bing Maps App SDK: http://connect.microsoft.com/bingmapapps
Note that there are also dedicated Bing Maps SDKs for iOS, Android, and WPF development, as well as the traditional AJAX control.
The name of the dll's can be different from the namespaces they provide. If I understand your question correctly, you already have access to everything you need. The four libraries are what you need to make your apps, while the dll files are what you are already using to get access to those namespaces.
In the example link you listed, he shows how make a reference to the map control namespace by doing the following:
xmlns:m="clr-namespace:Microsoft.Maps.MapControl; assembly=Microsoft.Maps.MapControl"
In this case, the assembly (dll file) and the namespace are the same, but they don't have to be and thats why they are specified separately.
From here, just add the map control.
<m:Map CredentialsProvider="Your_Credentials" />
Is it possible using VS2008 and C# to create a class library which can be treated as an ActiveX control on a Windows Mobile 6/6.1 device?
I am looking to retrieve the positioning details from a device so I can post the current location on a google map. I have this all working nicely as a application but I need to expose the same functionality from just from a web page so I think I am going to have to use an ActiveX control?
If there are any alternative approaches I could take that would be great.
Thanks
No. Since the CF lacks EE Hosting support, there's no way to create a COM/ActiveX control in managed code. You'll have to write in in C++ - there's just no other option.