【问题标题】:EventToCommandBehavior: send event args as CommandParameterEventToCommandBehavior:将事件参数作为 CommandParameter 发送
【发布时间】:2020-05-05 20:42:59
【问题描述】:

我使用来自https://docs.microsoft.com/ru-ru/xamarin/xamarin-forms/app-fundamentals/behaviors/reusable/event-to-command-behavior 的 Xamarin 团队提供的 EventToCommandBehavior。 我需要它来仅通过视图模型操作 Xamarin.Forms.Map 控件事件。案例:处理点击事件,然后获取点的位置...

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

一切正常,但我不知道如何将 Xamarin.Forms.GoogleMaps.MapClickedEventArgs 的 Point 属性作为命令参数传递。感谢您的宝贵时间!

【问题讨论】:

    标签: xaml xamarin xamarin.forms command eventtocommand


    【解决方案1】:

    解决了。命令的参数自动发送。您只需要记住将对象 arg 添加到您的操作中

    【讨论】:

    • 新用户只能在发布后 2 天接受自己的答案
    猜你喜欢
    • 1970-01-01
    • 2020-10-22
    • 1970-01-01
    • 2021-12-17
    • 2015-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-25
    相关资源
    最近更新 更多