title: Method to touch MapControl XAML to set route
body: <p>I implemented a WPF MapControl control in my Winform application.</p>
  
  <p>(Basically, add a WPF User Control project to your Winform solution. Drag and drop whatever WPF control. I chose a DevExpress WPF MapControl, but Microsoft's variant or any other control works just as nicely. Build the project once, and then drag and drop the control which then appears onto your Winform project. If you wish to set/get any properties or expose any methods, you would go to the associated C# code behind and make that public.)</p>
  
  <p>Problem:
  I want to create a method, which would have two GeoPoint arguments (longitude / latitude pairs). The method would then show the best route using BingMaps or the OpenMapDocs to show the route from point A to B, think Google Maps. I would call this method from a button or link on the Winform side.</p>
  
  <p>Now, I understand crystal clear how to implement the transition and method. Been there, done that, so to speak. I have the two GeoPoint longitude/latitude pairs inside the code behind for the control.</p>
  
  <p>My problem is how to handle the XAML side. I am not that familiar with WPF yet and the XAML side.</p>
  
  <p>DevExpress said:</p>
  
  <blockquote>
    <p>It is necessary to configure the route data service inside the XAML user control.</p>
  </blockquote>
  
  <p>That was not the most helpful.</p>
  
  <p>Any ideas?</p>
  
  <p>I am using .Net 4.5.</p>
  
  <p>Here is the XAML code for the DevExpress MapControl. The question is identical to the Microsoft MapControl. Both codes share very similar XAML, at least from my visual looking at it.</p>
  
  <pre><code>&lt;UserControl x:Class="bvMaps.MapDevex" 
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:dxm="http://schemas.devexpress.com/winfx/2008/xaml/map"
              mc:Ignorable="d"
              VerticalAlignment="Stretch"
              HorizontalAlignment="Stretch"&gt;
      &lt;Grid x:Name="MapContainer"&gt;
          &lt;dxm:MapControl HorizontalAlignment="Left" Margin="0,0,0,0" Name="mapControl1" VerticalAlignment="Top"&gt;
              &lt;dxm:InformationLayer&gt;
                  &lt;dxm:InformationLayer.DataProvider&gt;
                      &lt;dxm:BingSearchDataProvider BingKey="myBingKey"/&gt;
                  &lt;/dxm:InformationLayer.DataProvider&gt;
              &lt;/dxm:InformationLayer&gt;
              &lt;dxm:InformationLayer&gt;
                  &lt;dxm:InformationLayer.DataProvider&gt;
                      &lt;dxm:BingGeocodeDataProvider BingKey="myBingKey"/&gt;
                  &lt;/dxm:InformationLayer.DataProvider&gt;
              &lt;/dxm:InformationLayer&gt;
              &lt;dxm:InformationLayer&gt;
                  &lt;dxm:InformationLayer.DataProvider&gt;
                      &lt;dxm:BingRouteDataProvider BingKey="myBingKey"/&gt;
                      &lt;/dxm:InformationLayer.DataProvider&gt;
                  &lt;/dxm:InformationLayer&gt;
              &lt;dxm:ImageTilesLayer Margin="0,0,0,0"&gt;
                  &lt;dxm:ImageTilesLayer.DataProvider&gt;
                      &lt;dxm:BingMapDataProvider Kind="Road" BingKey="myBingKey"/&gt;
                  &lt;/dxm:ImageTilesLayer.DataProvider&gt;
                  &lt;/dxm:ImageTilesLayer&gt;
          &lt;/dxm:MapControl&gt;
      &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>