在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):nuitsjp/Xamarin.Forms.GoogleMaps.Bindings开源软件地址(OpenSource Url):https://github.com/nuitsjp/Xamarin.Forms.GoogleMaps.Bindings开源编程语言(OpenSource Language):C# 100.0%开源软件介绍(OpenSource Introduction):This maintenance is currently suspended. This is because developers can't take the time because of private changes. If you are a new user, please consider fork and managing it yourself. Xamarin.Forms.GoogleMaps.BindingsThis library is the MVVM(Bindings) support library for Xamarin.Forms.GoogleMaps. This library provides three types of functions.
Setup
If you cannot enable XAML Compilation.
global::Xamarin.Forms.Forms.Init();
Xamarin.FormsGoogleMaps.Init(this, bundle);
Xamarin.FormsGoogleMapsBindings.Init(); // Add this line
LoadApplication(new App()); UsageLearn how to touch and pin any part of the map.
MainPageViewModel.cspublic class MainPageViewModel
{
public ObservableCollection<Pin> Pins { get; set; }
public Command<MapClickedEventArgs> MapClickedCommand =>
new Command<MapClickedEventArgs>(args =>
{
Pins.Add(new Pin
{
Label = $"Pin{Pins.Count}",
Position = args.Point
});
});
} MainPage.xaml<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:googleMaps="clr-namespace:Xamarin.Forms.GoogleMaps;assembly=Xamarin.Forms.GoogleMaps"
xmlns:bindings="clr-namespace:Xamarin.Forms.GoogleMaps.Bindings;assembly=Xamarin.Forms.GoogleMaps.Bindings"
xmlns:local="clr-namespace:SimplestSample;assembly=SimplestSample"
x:Class="SimplestSample.MainPage">
<ContentPage.BindingContext>
<local:MainPageViewModel/>
</ContentPage.BindingContext>
<googleMaps:Map>
<googleMaps:Map.Behaviors>
<bindings:BindingPinsBehavior Value="{Binding Pins}"/>
<bindings:MapClickedToCommandBehavior Command="{Binding MapClickedCommand}"/>
</googleMaps:Map.Behaviors>
</googleMaps:Map>
</ContentPage> BindingPinsBehavior binds the Pins property of the map to ViewModel Pins. Behavior to bind the property supports only the OneWayToSource. Otherwise please see samples here. LicenseSee LICENSE.
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论