Skip to content

How should I pass the view model to long press command? #582

@nicholasyin

Description

@nicholasyin

Type of issue

Missing information

Description

I'm using this behavior in a collection view to display images, and I want to handle the long press command.
LongPressCommandParameter="{Binding .}" However, the currently touched image's bound view model can't be passed to the command, where it shows null as the view model's value.

Page URL

https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/behaviors/touch-behavior?tabs=toucheffect-xaml%2Ctouchbehavior-xaml#properties

Content source URL

https://github.com/MicrosoftDocs/CommunityToolkit/blob/main/docs/maui/behaviors/touch-behavior.md

Document Version Independent Id

98a8e0a6-ef8e-7427-100f-7b4448e0ffce

Platform Id

28950eda-3f84-b0ac-bd2b-243cce75aa34

Article author

@bijington

Metadata

  • ID: 98a8e0a6-ef8e-7427-100f-7b4448e0ffce
  • PlatformId: 28950eda-3f84-b0ac-bd2b-243cce75aa34
  • Service: dotnet-communitytoolkit
  • Sub-service: dotnet-maui-community-toolkit

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions