Skip to content

Commit 6e0aae9

Browse files
committed
Add context menu support for item views
This commit introduces an `ItemContextMenuListener` for the elements retrieved from the `itemsSource`. The listener is assigned to the `ItemView` of the `holder`, enabling context menu functionality for items at specified positions.
1 parent cb795c7 commit 6e0aae9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/PJ.ContextActions.Maui/PJCollectionViewHandler.android.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int positi
6464
if (position >= 0 && position < size)
6565
{
6666
var element = itemsSource.GetItem(position + 1);
67+
var contextMenuListener = new ItemContextMenuListener(element);
68+
holder.ItemView.SetOnCreateContextMenuListener(contextMenuListener);
6769

6870
}
6971
}

0 commit comments

Comments
 (0)