Emilia Larssen
Emilia Larssen

Reputation: 105

EventToCommandBehavior: send event args as CommandParameter

I use EventToCommandBehavior provided by the Xamarin team from https://learn.microsoft.com/ru-ru/xamarin/xamarin-forms/app-fundamentals/behaviors/reusable/event-to-command-behavior. I need it to manipulate Xamarin.Forms.Map control events only by the view model. Case: handle click event, then get point's location...

        <gmap:Map x:Name="map">
          <gmap:Map.Behaviors>
            <behaviors:EventToCommandBehavior
              EventName="MapClicked"
              Command="{Binding ClickMapCommand}"
              CommandParameter="{???}"/>
          </gmap:Map.Behaviors>
        </gmap:Map>

Everything works, but I don't know how to pass Xamarin.Forms.GoogleMaps.MapClickedEventArgs's Point property as a command parameter. Thanks for your time!

Upvotes: 1

Views: 2172

Answers (1)

Emilia Larssen
Emilia Larssen

Reputation: 105

Solved. Command's parameter sends automatically. All you need is just to remember to add object arg to your Action

Upvotes: 6

Related Questions