LongPressCommand="{Binding Source={x: Reference longContentView}, Path=BindingContext.DeleteOrEditCommand }", then the command is not called
I don't see any issue here. May be I'm missing something.
Above you're setting binding source to your contentview. So, Unless your MessageModel object (item of our collection view) have a DeleteOrEditCommand defined, nothing will happen. Because, every binding inside collection view template points to you MessageModel object.
If your Command is defined in ViewModel, then your first approach will trigger the command since you explicitly set source outside the itemtemplate of collectionview
LongPressCommand="{Binding Source={x:Reference collectionView}, Path=BindingContext.DeleteOrEditCommand }"
( In this case the binding's will point to BindingContext set to page i.e ViewModel).