【问题标题】:How can I implement SfMap in Xamarin如何在 Xamarin 中实现 SfMap
【发布时间】:2021-10-25 14:22:03
【问题描述】:

如何在基于 MVVM 结构的项目中实现 SfMaps?第一,我必须获取我当前的位置并将其显示在地图上,然后我必须将该标记点拖动到任何地方并将其设置为当前位置

【问题讨论】:

标签: xamarin xamarin.forms xamarin.android xamarin-studio


【解决方案1】:

从 NuGet 将 SfMaps 添加到您的项目中。在android中不需要原生配置,但要在iOS中启动SfMaps,在AppDelegate类的FinishedLaunching重写方法中调用SfMapsRenderer.Init()

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
    …
    global::Xamarin.Forms.Forms.Init ();
    Syncfusion.SfMaps.XForms.iOS.SfMapsRenderer.Init();
    LoadApplication (new App ());
    …
}

在您的视图文件中添加以下命名空间。

xmlns:maps="clr-namespace:Syncfusion.SfMaps.XForms;assembly=Syncfusion.SfMaps.XForms"

并将以下代码添加到视图中初始化地图

<maps:SfMaps >
  
</maps:SfMaps>

这是在 Xamarin 中添加 SFMap 的一种非常基本的方法。更多详细信息和帮助的表格 请访问此链接:https://help.syncfusion.com/xamarin/maps/getting-started?cs-save-lang=1&cs-lang=xaml

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-26
    • 1970-01-01
    相关资源
    最近更新 更多