AnsweredAssumed Answered

Embedded WPF ArcGIS Runtime .NET User Control into WPF application

Question asked by borja.paresesri-es-esridist Employee on Jul 4, 2019
Latest reply on Jul 5, 2019 by borja.paresesri-es-esridist

Dear All,

 

I'm developing an application with WPF for .NET through a project inside a Solution in Visual Studio 2017. It has several non ArcGIS functionalities.

 

In the same solution I added a new project to develop some GIS functionalities with ArcGIS Runtime SDK for .NET. In this project, I installed the ESRI.Runtime.WPF package from NuGet. This poject is an UserControl project with an XAML file. I have added a Mapview to the XAMl as the guide says:

 

<UserControl x:Class="GISModule.UserControl1"
             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:esri="http://schemas.esri.com/arcgis/runtime/2013"
             xmlns:local="clr-namespace:GISModule"
             mc:Ignorable="d"
             d:DesignHeight="450" d:DesignWidth="800">
    <Grid>
        <esri:MapView>
            <esri:Map>
                <esri:Map.Basemap>
                    <esri:Basemap Name="Basemap">
                        <esri:ArcGISTiledLayer Name="World Topographic"
                Source="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
                    </esri:Basemap>
                </esri:Map.Basemap>
            </esri:Map>
        </esri:MapView>
    </Grid>
</UserControl>

Then, I have referenced the GIS project in the Non GIS project and added the tags in the main XAML

 

<Window x:Class="MainModule.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:MyNamespace="clr-namespace:GISModule;assembly=GISModule"
        xmlns:local="clr-namespace:MainModule"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <MyNamespace:UserControl1/>
    </Grid>
</Window>

Now, an error is presented in the tag <MyNamespace:UserControl1/>

 

Error Initializing ArcGISRuntimeEnviroment. Unbale to find ArcGIS Runtime deployment folder. I attach the error.

 

If I install the ESRI.Runtime.WPF package in the Non GIS project, the problem is solved, but I wouldn't want to install the package in each project.

 

Is there any way to solve this issue without installing the package in the Non GIS project?

 

Thanks in advance.

Attachments

Outcomes