Android 平台不会像在 Windows 中那样在 .NET MAUI 中触发我的搜索处理程序的命令方法,有什么想法吗?

问题描述 投票:0回答:0

与 Windows 平台上的行为不同,我的搜索处理程序不会触发我在 Android 平台上的命令方法

我试过放置手势识别器,但这也不起作用。

我的视图模型类上的方法“SelectGymCommand”将所选项目添加到绑定到列表视图的 SelectedGyms 列表中。这在 windows 平台上完美运行,但在 android 平台上,列表视图未更新。

> `<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:utils="clr-namespace:BehaviorMauiApp.Utils"
xmlns:viewModel="clr-namespace:BehaviorMauiApp.ViewModel"
xmlns:model="clr-namespace:BehaviorMauiApp.Model"
x:Class="BehaviorMauiApp.View.FitnessPage" 
x:DataType="viewModel:GymViewModel"
Title="FitnessPage">
>     <Shell.SearchHandler>
>         <utils:SearchGymHandler
x:Name="searchGymHandler"
GymToSearch="{Binding ListGym}"
Placeholder="pesquisar"
Command="{Binding SelectGymCommand}"
CommandParameter="{Binding Source={x:Reference searchGymHandler}, Path=SelectedItem}">
>             <utils:SearchGymHandler.ItemTemplate>
>                 <DataTemplate   x:DataType="model:Gym" >
>                     <Grid Padding="8" RowDefinitions="*">

>                         <Label Margin="8" TextColor="Gray" Text="{Binding Description}" >
>                         </Label>
>                     </Grid>
>                 </DataTemplate>
>             </utils:SearchGymHandler.ItemTemplate>
>         </utils:SearchGymHandler>
>     </Shell.SearchHandler>
>     <VerticalStackLayout>
>         <Image Aspect="Center" Margin="0,32,0,0" Source="outline_fitness_center_white_48dp.png" />
>         <ListView ItemsSource="{Binding SelectedGyms}">
>             <ListView.ItemTemplate>
>                 <DataTemplate x:DataType="model:Gym">
>                     <ViewCell>
>                         <Label Margin="8" TextColor="Gray" Text="{Binding Description}"></Label>
>                     </ViewCell>
>                 </DataTemplate>
>             </ListView.ItemTemplate>
>         </ListView>
>     </VerticalStackLayout>
> </ContentPage>`
.net search searchbar maui-windows .net-maui.shell
© www.soinside.com 2019 - 2024. All rights reserved.