【问题标题】:Xamarin AutoSuggestBox Selected Item as Command ParameterXamarin AutoSuggestBox 选定项作为命令参数
【发布时间】:2023-01-12 18:13:09
【问题描述】:

我的小组成员问我是否可以在我的申请中加入自动建议。经过一些研究,我决定使用这个 AutoSugggestionBox 并遵循 this 教程。但是,我很难显示选定的建议,因为我正在将其转换为 MVVM。在时间戳 16:12,他使用 dotMorten.Xamarin.Forms.AutoSuggestBoxQuerySubmittedEventArgs 参数获取 ChoseSuggestion。

我的问题是,如果我使用xct:XamarinCommunityTools EventToCommandBehavior,我会在CommandParameter中输入什么?

<control:AutoSuggestBox PlaceholderText="Enter" 
                x:Name="AutoSuggestBox">
    <control:AutoSuggestBox.Behaviors>
        <xct:EventToCommandBehavior EventName="QuerySubmitted"
                                    Command="{Binding quesrySubmitComm}"
                                    CommandParameter=""
    </control:AutoSuggestBox.Behaviors>
</control:AutoSuggestBox>

或者是否有更简化的方法来对 AutoSuggestBox 进行 MVVMify? 预先感谢您的回答。

【问题讨论】:

    标签: c# xamarin


    【解决方案1】:

    为此使用建议选择!

    你不需要这个命令。

    尝试这个。

    <control:AutoSuggestBox PlaceholderText="Enter" 
                            x:Name="AutoSuggestBox"
                            SuggestionChosen="SuggestionChosen"/> 
    

    创建方法并获得选择。

    【讨论】:

      猜你喜欢
      • 2021-02-02
      • 1970-01-01
      • 1970-01-01
      • 2012-10-26
      • 1970-01-01
      • 1970-01-01
      • 2021-12-20
      • 2020-07-20
      相关资源
      最近更新 更多