以编程方式设置 EmbeddedResource 属性

问题描述 投票:0回答:1

我正在开发一个小型 WPF 项目,我使用 SfMap 组件在地图上显示 shp 文件。为了使它们出现,将文件添加为EmbeddedResource(我从syncfusion获得的信息)。但我的问题是 shp 文件位于不同的文件夹中,可以更改、添加或删除。有没有办法以编程方式设置此属性? (这是我的示例代码)我的代码中的文件位于我的项目的 Images 文件夹中,但将来它将来自不在项目中的另一个文件夹。感谢您的帮助。

<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>
c# wpf xaml shapefile syncfusion
1个回答
0
投票

来自Syncfusion的回答:

关于“是否可以将形状文件放在其他文件夹中?”:

是的,可以将形状文件放在项目外部的另一个文件夹中,并且可以在 ShapeFileLayer 中加载该文件,如以下代码片段所示。

[代码片段]:

<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>
© www.soinside.com 2019 - 2024. All rights reserved.