ArcGIS web map in c# winform - c#

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.

Related

Windows Form based application layout/template

I am very new to Windows form based application. I have Visual studio 2012 and want to create a windows application.
This question might be asked before but I was not able to find any clear answer, so I decided to post the question here..
I want to know that if there is a way to create a master form (or a kind of template) for my application having common controls and rest of the forms can inherit that, likewise we do in web-applications.
I found somewhere that instead of going with Windows Forms application, I should go with WPF application, if that is the case can somebody point me to a good article where I can find some info about it....
I really advise you to work with WPF, windows forms is dead since years. WPF is very flexible and you can do far more things than windows forms.
Here is how to implement Master-Page like behavior using WPF: Link.
Here are some WPF tutorial to start your journey:
http://www.wpftutorial.net/
http://www.tutorialspoint.com/wpf/
Learning WPF and XAML is great as it is very similar to most new technologies like Android (layouts), Xamarin (Forms), etc... So it is good technology to learn.

Using WinRT library in WPF application.

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.

Style my .Net desktop application GUI with Silverlight/windows phone-style controls

I am writing my first vb.net application ( But I will tag c# here as well, as I am sure even a c# person can answer this with the similar .net implementation).
Short Description of my Applicaiton:
My desktop application will run on win platform only, using vb.net, it is a simple internet cafe management software, with a server gui running on server, and a client gui running on workstations, both communicating with TCP/IP to allocate time to customers, and the server storing some data in either xml files ( for human operators login info e.g) or in a small database. Nothing complicated.
What I would like to do:
I'd like to have a "sexy" look, i.e. either silverlight look or win7 phone look, yet this is a desktop application. I'd like to use CSS but its entirely optional, if there is a simple way to have my controls look like below without CSS thats fine with me.
What I have tried
I have looked into just doing a silverlight out of browser app, but as I am new to .net, and even though I have read up as many articles about using silverlight5 out of browser, I don't want to be caught down the road when I want to implement a feature and realize "Oh silverlight out of box doesnt support that".
So my question is , how do I implement one of the new looks in the picture in my desktop vb app?
You should look at using WPF for your application instead of using WinForms.
WPF (Windows Presentation Foundations) is a platform which works same way as silverlight but on desktop (as far as you need to be aware now.) Silverlight is a cut down version of WPF so WPF will give you a lot more controls and a lot more control over the program.
WPF uses XAML to draw up the UI and it holds the code in the source code file associated to the xaml file. If you have experience using Silverlight you should easily be able to make programs with WPF.
WPF is really powerful and gives you access to all the styling that is possible on Silverlight. WinForms is more so restricted which makes it harder to abandon the consistent Windows look and make your own intuitive and innovative UI.
Hope it helps!
Here are some tutorials if you are interested:
WPF Tutorials
Here is an example WPF desktop app (exact same look as achievable with Silverlight)
You can use wpf with Mahapps Metro : http://mahapps.com/MahApps.Metro/

How to use the Bing Maps Silverlight Control in a WPF project?

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.

What is Silverlight's relationship -- if any -- to WPF?

I was working with a WPF application and I decided that the controls and graphics I wanted to display on the grid might look better if it was a silverlight component.
I thought this way because of all the cool silverlight controls that look very flash-like.
But now that I have gottem my Visual Studio 2010 set up with SIlverlight, it seems that every silverlight app I can make are ASP.NET in nature. It seems that instead of a cool GUI control to make, Silverlight is telling me that it is primarely a dataflow sort of application for the web.
What is the relationship, if any, between WPF and Silverlight. Can I or can I not put a silverlight control into my existing WPF application?
It's my understanding that Silverlight is like "WPF lite", and that in many ways they are almost the same thing but made for different purposes (desktop vs. web). If you want your wpf application to have a different look, you don't need to bring in any other controls from silverlight, because you can simply re-style or re-template them to suit your needs (which you can also do in silverlight). But you can't simply use silverlight controls in wpf because they're compiled to run on different runtimes.
Silverlight does have a number of un-official controls in the silverlight toolkit which are not included in wpf or the wpf toolkit. They are open source, and if you really want, you could port them to wpf, especially since the code is very similar to wpf.
Silverlight is essentially a subset of WPF that is used to create web-based applications.
You might be able to jump through some hoops to get a limited Silverlight application running in WPF, but I doubt it would be worth it...
I know others may point out that SL is WPF lite.
But hope you find out they are different frameworks at least right now though they share XAML, and a similar model.
Not sure if in the future they become the same, but keep the differences in mind is critical at this moment. :)
We know DevExpress is now shipping the same code base of their components for WPF and SL, but that does come after putting a lot of efforts.
http://community.devexpress.com/blogs/ctodx/archive/2010/04/20/merging-our-silverlight-and-wpf-ui-controls.aspx

Categories

Resources