Формы Xamarin - Как включить ListView ViewCell.ContextActions в Xamarin. Android TabbedPage? - PullRequest
0 голосов
/ 14 апреля 2020

У меня проблемы с включением ViewCell.ContextActions для Android.

У меня есть TabbedPage, где я отключил параметр SwipePaging (android: TabbedPage.IsSwipePagingEnabled = "False") и в ContentPage I есть ListView, где я хотел бы отобразить ContextActions MenuItens.

Однако в Android не Swiping, даже после попытки включить параметр в ViewCell (android: ViewCell.IsContextActionsLegacyModeEnabled = "true") как описано в следующей статье: https://docs.microsoft.com/pt-br/xamarin/xamarin-forms/platform/android/viewcell-context-actions

Еще одна вещь, я получаю следующее сообщение:

присоединяемое свойство 'IsContextActionsLegacyModeEnabled' не было найдено.

Вкл. IOS все работает как шарм!

MainPage.xaml

<TabbedPage
   xmlns:android="clr- namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core" android:TabbedPage.IsSwipePagingEnabled="False" >

ListView.xaml

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         xmlns:d="http://xamarin.com/schemas/2014/forms/design"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core">
<ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell android:ViewCell.IsContextActionsLegacyModeEnabled="true">
                    <ViewCell.ContextActions>
                        <MenuItem Clicked="OnUpdate" CommandParameter="{Binding .}" Text="Update" />
                        <MenuItem Clicked="OnDelete" CommandParameter="{Binding .}" Text="Delete" IsDestructive="True" />
                    </ViewCell.ContextActions>...</ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
...