Set EmbeddedResource Property programmatically

56 Views Asked by At

I'm working on a little WPF project and I use SfMap component to show shp file on a map. To make them appear the file add to be set as EmbeddedResource (information that i get from syncfusion). But my problem is the shp file are in a different folder and can be changed, added or deleted. Is there a way to set this property programmatically or not ? (thi is my code for the example) The file in my code is in the Images folder of my project but in the future it will come from another folder not in the project. Thanks for your help.

<syncfusion:SfMap>
    <syncfusion:SfMap.Layers>
        <syncfusion:ImageryLayer LayerType="OSM" >
            <syncfusion:ImageryLayer.SubShapeFileLayers>
                <syncfusion:SubShapeFileLayer  Uri="MyApp.Images.V1.shp">
                    <syncfusion:SubShapeFileLayer.ShapeSettings>
                        <syncfusion:ShapeSetting  ShapeStroke="#C1C1C1" ShapeStrokeThickness="0.5"  ShapeFill="Chocolate"/>
                    </syncfusion:SubShapeFileLayer.ShapeSettings>
                </syncfusion:SubShapeFileLayer>
            </syncfusion:ImageryLayer.SubShapeFileLayers>
        </syncfusion:ImageryLayer>
    </syncfusion:SfMap.Layers>
</syncfusion:SfMap>
1

There are 1 best solutions below

0
Nicolas Lagnitre On BEST ANSWER

Answer from Syncfusion :

Regarding “Is it possible to have the shape file in other folder?”:

Yes, it is possible to have the shape file in another folder outside your project and can load the file in the ShapeFileLayer, as shown in the following code snippet.

[Code snippet]:

<syncfusion:ImageryLayer x:Name="imageryLayer" LayerType="OSM">

    <syncfusion:ImageryLayer.SubShapeFileLayers>

        <syncfusion:SubShapeFileLayer x:Name="shapeLayer"

                                      Uri="E:\\MyProject\\usa_state.shp">

            <syncfusion:SubShapeFileLayer.ShapeSettings>

                <syncfusion:ShapeSetting  ShapeStroke="#C1C1C1"

                                          ShapeStrokeThickness="0.5"

                                          ShapeFill="Chocolate" />

            </syncfusion:SubShapeFileLayer.ShapeSettings>

        </syncfusion:SubShapeFileLayer>

    </syncfusion:ImageryLayer.SubShapeFileLayers>

</syncfusion:ImageryLayer>