Legen Sie SwipeCardView SelectedItem auf eine Variable im Xamarin-Format fest

Legen Sie SwipeCardView SelectedItem auf eine Variable im Xamarin-Format fest

Die Lösung zum Setzen von SwipeCardView SelectedItem auf eine Variable in Xamarin-Form
ist unten angegeben:

Ich versuche seit mehr als 3 Tagen eine Lösung für meine App zu finden, aber ohne Erfolg.

Ich muss die aktuelle Benutzer-E-Mail aus einer SwipeCardView lesen, wenn der Benutzer auf eine Schaltfläche wischt oder klickt, und sie in einer Variablen speichern, um sie später zu verwenden. Gibt es eine einfache Lösung, um dieses Ziel zu erreichen?

Siehe mein xaml:

<swipeCardView:SwipeCardView 
            x:Name="SwipeCardView"
            ItemsSource="{Binding Candidates}" SwipedCommand="OnSwiped" SwipedCommandParameter="{Binding email}"
            HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
            Padding="10"
            SupportedSwipeDirections="Left,Right,Up">
            <swipeCardView:SwipeCardView.ItemTemplate>
                <DataTemplate>
                    <StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
                        <Frame CornerRadius="10" Padding="8" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" >
                            <AbsoluteLayout>
                                <Image Source="{Binding profilePicture}" Aspect="AspectFill" AbsoluteLayout.LayoutBounds=".5, 0.5, 1, 1" AbsoluteLayout.LayoutFlags="All"></Image>
                                <Frame x:Name="fCandiate"  CornerRadius="10" Padding="8" HeightRequest="50" AbsoluteLayout.LayoutBounds=".10, .98, 0.80, 0.20" AbsoluteLayout.LayoutFlags="All">
                                    <StackLayout>
                                        <Label Text="{Binding fullName}" TextColor="#4f4f4f" FontSize="Large" FontAttributes="Bold" />
                                        <BoxView Color="#4f4f4f" HeightRequest="2" HorizontalOptions="Fill" />
                                        <Label x:Name="candEmail" Text="{Binding email}" TextColor="#6f6f6f" FontSize="Medium" />
                                    </StackLayout>

                                </Frame>
                            </AbsoluteLayout>
                        </Frame>
                    </StackLayout>
                </DataTemplate>
            </swipeCardView:SwipeCardView.ItemTemplate>
</swipeCardView:SwipeCardView>

Und meine xaml.cs

private void OnLikeClicked(object sender, EventArgs e)
        {
            string email =  "???? (read from current item on SwipeCard)";
            SwipeCardView.InvokeSwipe((MLToolkit.Forms.SwipeCardView.Core.SwipeCardDirection)MLToolkit.Forms.SwipeCardView.Core.SwipeCardDirection.Right);
            DisplayAlert("Success", "You accepted the candidate. Page will be developed later" + email, "OK");
        }

private void OnSwiped(object sender, SwipedCardEventArgs e)
        {
            switch (e.Direction)
            {
                case SwipeCardDirection.None:
                    break;
                case SwipeCardDirection.Right:
                    DisplayAlert("Success", "You accepted the candidate. Page will be developed later" + e.Parameter.ToString(), "OK");
                    break;
                case SwipeCardDirection.Left:
                    break;
                case SwipeCardDirection.Up:
                    break;
                case SwipeCardDirection.Down:
                    break;
            }
        }

Jede Hilfe wird geschätzt.

in OnLikeClicked

var item = (MyClassName)SwipeCardView.TopItem;
var email = item.email;

oder in OnSwiped

var item = (MyClassName)e.Item;
var email = item.email;


No