Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DXCollectionView.SwipeItemShowing Event

Fires when a swipe item is about to be shown when a user swipes a row from left to right or from right to left, and allows you to cancel the action.

Namespace: DevExpress.Maui.CollectionView

Assembly: DevExpress.Maui.CollectionView.dll

NuGet Package: DevExpress.Maui.CollectionView

#Declaration

C#
public event EventHandler<SwipeItemShowingEventArgs> SwipeItemShowing

#Event Data

The SwipeItemShowing event's data class is SwipeItemShowingEventArgs. The following properties provide information specific to this event:

Property Description
Cancel Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.
IsStartSwipeItem Gets whether the processed swipe item is about to be displayed on the left side of a DXCollectionView‘s row.
Item Gets the data item that corresponds to the processed DXCollectionView row.
RowHandle Gets the handle of the row that contains the item that will be swiped.
SwipeItem Gets the swipe item for which the SwipeItemShowing event is raised.

#Remarks

In the markup below, the right-side swipe item is Reply. The code below shows how to prevent this item from showing if the sender’s email contains “donotreply”.

<dxcv:DXCollectionView x:Name="collectionview" ItemsSource="{Binding OutlookData}" SwipeItemShowing="collectionview_SwipeItemShowing">
    <dxcv:DXCollectionView.ItemTemplate>
        <DataTemplate>
            <dxcv:SwipeContainer>
                <dxcv:SwipeContainer.ItemView>
                    <dx:DXStackLayout Orientation="Vertical" ItemSpacing="6">
                        <Label Text="{Binding Sender}"/>
                        <Label Text="{Binding email}"/>
                    </dx:DXStackLayout>
                </dxcv:SwipeContainer.ItemView>
                <dxcv:SwipeContainer.StartSwipeItems>
                    <dxcv:SwipeContainerItem Caption="Sender Info" BackgroundColor="##26a95e" />
                </dxcv:SwipeContainer.StartSwipeItems>
                <dxcv:SwipeContainer.EndSwipeItems>
                    <dxcv:SwipeContainerItem Caption="Reply" BackgroundColor="#797bff" />
                </dxcv:SwipeContainer.EndSwipeItems>
            </dxcv:SwipeContainer>
        </DataTemplate>
    </dxcv:DXCollectionView.ItemTemplate>
</dxcv:DXCollectionView>
using DevExpress.Maui.CollectionView;

private void collectionview_SwipeItemShowing(object sender, SwipeItemEventArgs e) {
    DXCollectionView collectionView = sender as DXCollectionView;
    string from = e.Item.ToString();
    if (from.Contains("donotreply") && !e.IsStartSwipeItem)
        e.Cancel = true;
}
See Also