Visual Studio 2008 .NET 3.5 Version

Apr 8, 2011 at 4:18 PM

Hi,

Can you tell me if the apps work on VS 2008 .NET 3.5?  I'm not able to use the GraphicsTest.  Any help on this matter is very much appreciated

Thanks.

Regards,

Chris

Coordinator
Apr 11, 2011 at 2:35 AM

I'm not sure about VS 2008 and .NET 3.5 since the project started life as Silverlight 3 only. However, I did modify the VS 2010 solution files to run with .NET 3.5 instead of .NET 4.0, as a quick test, and was able to get GraphicsTest to compile and run without any major problems. I did have to add WindowsBase to the references for the LoadResources.WPF project in Appendices.sln. Also GraphicsTest failed when running the Miscellany tab due to an inability to find resources/icelandflag64.png. Based on previous experience I expect this is a problem with the way .NET handles linked resource files and that replacing the Iceland flag "link" with the actual "file" would solve this issue (as would changing the apparent location of the reference to use the root project directory rather than the resources directory).

There was also a complaint about a missing Navigation tag in the ESRI map client toolkit DLL which kept the EsriMapTest.WPF project from building.

Let me know if it would be worthwhile checking in the VS 2010 solution files for .NET 3.5. I can load VS 2008 and check for issues but that will take a week to sort out. If that is not a reasonable timeframe, please let me know. 

Apr 11, 2011 at 10:17 AM

Hi

First of all, thank you for your prompt reply.  Really appreciate that.

I managed to compile the LoadResources, Appendixes, MilGraph and MilSymbol modules.  The trouble is my application is Desktop WinForm-based and I'm trying to figure out how to render the symbols the window form, for example, as image on a picture box. 

That's the first step.  My ultimate aim, is to display the symbols on a third party mapping tool called, (MapInfo) MapXtreme 2008.

Regards,

Chris

 

 

Coordinator
Apr 12, 2011 at 1:57 AM

I don't really have a lot of suggestions for targeting a Windows form. Some possibilities:

  • A PictureBox for each symbol - which you mentioned. Generating a PNG should be possible. You can cache the bitmaps for reuse.
  • Bitblt the entire Windows form as a background to an off-screen WPF form, draw the symbology on top of the WPF form, and then bitblt the image back to the Windows form. Depending on the map projection support this might be a possibile way to support some dynamic operations. This could create a lot of problems with symbol registration, interactivity, and the proper capture of events.
  • Convert the generated XAML for each symbol to WMF (or EMF) for display on the Windows form (don't know if the XamlToys CodePlex project could help or not). Not sure what MapXtreme's support for EMF/WMF is or if this would provide any advantage over raster images.

There might be other symbol packages that would provide better support for Windows forms.

 

 

Apr 13, 2011 at 12:08 PM

There are 2 viable approaches that you can look into. One involves hosting WPF controls into windows forms and the other approach involves hosting Windows Forms controls in WPF. Looking at the MSDN pages on WPF and Windows Forms Interoperation has a few tutorials to help get you stated.

More than likely you will want to look at the ElementHost control that allows you to host WPF elements in Windows Forms.

Going the other way, there is a WindowsFormsHost control that you can host Windows Forms controls in WPF.

Whichever way you go, there are some caveats with each apporach, the biggest one being air space where no elements from WPF / Windows Forms can be on top of or below each other. For example, you cannot overlay a Windows Forms popup on top of a WPF map with symbols ... but you can use the WPF map and send the symbol data when selected to the Windows Forms control. Here is one helpful link with some gotchas for Windows Forms and WPF interop.

One last thing, be sure to Bing for WPF and Windows Forms interop and you will have many resources to aid you.