ThinkGeo.com    |     Documentation    |     Premium Support

Documentation on implementing a WPF solution

Hi,


Are there any white papers or other documentation (samples?) that explain specifically how to implement Map Suite into a WPF solution?



Hey Steve.



Step1 : Add a reference to required MapSuite assemblies (found on my machine here: "C:\Program Files\ThinkGeo\Map Suite Desktop Full Edition 3.0 (BETA)\Developer Reference\DesktopEdition"



Step 2: Add the namespace reference to the top of the XAML file that you are placing the control into.

For example, if I wanted to reference tha namespace as "map", i'd add this: xmlns:map="clr-namespace:ThinkGeo.MapSuite.DesktopEdition;assembly=DesktopEdition". (Note that although you need to reference all the assemblies in the project, you only need to add the DesktopEdition namespace reference tot he XAML window or usercontrol.



Step 3: Add the control to the framework element (e.g. Grid / Stackpanel etc) that will contain the map. E.g.



 < map:WpfMap x:Name="MapControl" Width="500" Height="500"></map:WpfMap>


<map:wpfmap x:name="MapControl"></map:wpfmap>


Step 4: Everything else is the same as the winforms control (code-behind setup etc).


Step 5: Enjoy the ability to overlay your other WPF elements on top of the map.


See the attachment for the XAML file (Had to rename the extension to a .txt  as XAML files cannot be uploaded here... I think someone should allow that).



365-example.txt (404 Bytes)

Brendan, 
  
   Thanks for the post.  I will look into why people can only attach txt files.  I think there are some limitations to the forums plugin we have.  I will let you know. 
  
 David

I’m having fun posting code:P i’ll get it right eventually. Sorry if any RSS updates spam you.

Yay… success:P

Brendan, 
  
   No worries.   
  
 David

Hi Brendan, 
  
 i did put the reference you mentioned using Blend, it compiled withour errors. But using WPF together with Thinkgeo map is a brand new world to me. Although it is easy to manipulate events of WPF elements usinf VS2008,  i dont know how to manipulate mapevents like when user click on the map, mouse hover on a feature of dynamicoverlay…etc. Would you please share some ideas on that? 
  
 thanks 
  
 Ric




 


Ric,


Here is a sample using the WPF map with the current version (3.0.119). It also shows how to use the Click event with the mapControl, I think that will give you a good idea how to handle events in WPF.



Thanks,


Ben




483-WpfDemoWithMapClick.zip (102 KB)