SwipeView design issue

Eduardo Gomez 3,426 Reputation points
2022-03-11T11:18:07.86+00:00

Hello

I want to put that trash icon more to the left, so when I start to swipe I can reveal the icon, like this

182195-image.png

182281-image.png

this is my collectionView

<CollectionView  
            ItemsSource="{Binding FireBaseNotebookNotes}"  
            SelectedItem="{Binding SelectedNotebook}"  
            SelectionChangedCommand="{Binding SelectedItemCommand}"  
            SelectionMode="Single">  
  
            <CollectionView.ItemTemplate>  
                <DataTemplate>  
                    <SwipeView>  
                        <SwipeView.LeftItems>  
                            <SwipeItems Mode="Execute">  
                                <SwipeItem  
                                    BackgroundColor="{StaticResource DeleteItemColor}"  
                                    Command="{Binding Source={RelativeSource AncestorType={x:Type vm:NotebooksPageModel}}, Path=DeleteNotebookCommand}}"  
                                    CommandParameter="{Binding .}"  
                                    Text="{translate:Translate Delete}">  
                                    <SwipeItem.IconImageSource>  
                                        <FontImageSource  
                                            FontFamily="fa"  
                                            Glyph="{Static icon:IconFont.TrashCan}"  
                                            Size="30" />  
                                    </SwipeItem.IconImageSource>  
                                </SwipeItem>  
                            </SwipeItems>  
                        </SwipeView.LeftItems>  
  
                        <yummy:PancakeView community:TouchEffect.PressedBackgroundColor="{StaticResource PressedItems}">  
  
                            <Grid Padding="5" RowDefinitions="Auto,1,Auto">  
  
                                <Label Style="{StaticResource BookIconStyle}" TextColor="{Binding Color}" />  
  
                                <Label  
                                    Margin="20,0,0,0"  
                                    Style="{StaticResource DateLabelStyle}"  
                                    Text="{Binding CreatedDate}" />  
  
                                <BoxView Grid.Row="1" />  
  
                                <Label  
                                    Grid.Row="2"  
                                    FontAttributes="Bold"  
                                    Text="{Binding Name}" />  
                            </Grid>  
                        </yummy:PancakeView>  
  
  
                    </SwipeView>  
                </DataTemplate>  
            </CollectionView.ItemTemplate>  
  
        </CollectionView>  
  

Project
https://github.com/eduardoagr/DuoNotes

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,363 questions
0 comments No comments
{count} votes

Accepted answer
  1. JarvanZhang 23,961 Reputation points
    2022-03-14T02:32:56.037+00:00

    Hello,​ EduardoGomez-1870

    This is because you set the Mode of SwipeItem to Execute. The Execute mode indicates that a swipe executes the swipe items. If you want to reveal the icon, please remove the mode setting because Reveal is the default mode.

    Here is the related doc, you could refer to: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/swipeview#swipe-mode

    Best Regards,

    Jarvan Zhang


    If the response is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.