Load shape file and zoom on it

Hi everyone,

I would like to know if someone already get the issue as me. I have a usercontrol with a SfMaps control. In a listview in another usercontrol, I can choose a shape file. When I click on it, it bind some informations on the first usercontrol, the file is shown on the map, and i define the center and the zoom level. Everything works well until I pan or zoom on the map. Afer that the binding for the center or the zoom level seems to be broken. If someone can help me, thanks. This is my xaml code :

    <maps:SfMap.Layers>

        <maps:ImageryLayer x:Name="Layer"

            BingMapKey="{Binding Source={x:Static properties:Settings.Default}, Path=BingKey}"

            BingMapStyle="Road"

            Center="{Binding Center}">

            <maps:ImageryLayer.SubShapeFileLayers>

                <maps:SubShapeFileLayer Uri="{Binding FilenamePlan}">

                    <maps:SubShapeFileLayer.ShapeSettings>

                        <maps:ShapeSetting

                            ShapeFill="Chocolate"

                            ShapeStroke="#C1C1C1"

                            ShapeStrokeThickness="0.5" />

                    </maps:SubShapeFileLayer.ShapeSettings>

                </maps:SubShapeFileLayer>

            </maps:ImageryLayer.SubShapeFileLayers>

        </maps:ImageryLayer>

    </maps:SfMap.Layers>

</maps:SfMap>


3 Replies 1 reply marked as answer

VO Vishal Omprasad Syncfusion Team March 1, 2024 12:23 PM UTC

Hi Nicolas,

Regarding “load and zoom shape file”:

Based on the shared details we have checked the reported query with your provided code snippet, but we are unable to replicate the reported scenario from our end. In the sample, as you have specified, we included a ListView, and upon selecting an item in the ListView, we added a new shape to the map and updated the ImageryLayer’s Center. We observed that the zoom and center functionality worked correctly without any issues. We have attached the tested sample below for your reference.

Please check our sample and let us know whether you are still facing the same issue. If the problem persists, kindly modify our sample and revert to us with the following details which would help us to check on it and provide you a better solution as soon as possible.

  • Share the issue replicated video.

  • Share the issue reproducible code snippet.

  • Share the issue reproducible sample.

Regards,
Vishal O.


Attachment: MapListView_7ceee1de.zip

Marked as answer

NL Nicolas Lagnitre March 3, 2024 10:49 AM UTC

Thanks ! again you solve my problem. It seems that you can't bind center and zoom directly. So I add hidden textbox and I work with the textChanged event. Now it works !

Thanks again



PR Preethi Rajakandham Syncfusion Team March 4, 2024 05:01 AM UTC

Hi Nicolas Lagnitre,

You're welcome. Glad that your issue is resolved. Please let us know if you need further assistance. As always, we are happy to help you out. 

Regards,

Preethi R


Loader.
Up arrow icon