0

I've currently got a ListView with a ViewCell which has a MenuItem, the ListView's SelectionMode is on Single by default since I only want to be selecting one Item at a time for a popup, but when I enable the MenuItem I want to be able to change the selection mode to Multiple to be able to export some info from multiple cells in the list at once rather than: click cell 1 => export => click cell 2 => export etc.

So is there an OnAppear() event or something similar that I can use to selectively toggle the selection mode? I haven't been able to find anything similar on here or on Microsoft's Official Documentation.

A-Fairooz
  • 410
  • 3
  • 11
  • No, there isn't. But if you want to change the SelectionMode when you "enable" the MenuItem, why don't you just tie it to the "enable" code? Why is OnAppearing needed? – Jason Nov 22 '21 at 16:36
  • Apologies I didn't really phrase it correctly, I'm not enabling the MenuItem programmatically I'm just using the default press-and-hold to enable it – A-Fairooz Nov 22 '21 at 16:39
  • I don't think that works from a UI standpoint. How would you signal to the user that now they can select additional cells? How does a user say they want to export one, vs export multiple? You may require an extra step to just do one! (Otherwise, they are still in this multi-select mode.) I think you will have confused users. Instead, have a "multi-select" mode toggle. When it is on, touching an item doesn't do the pop-up, it just adds to the selection. Then press-and-hold to bring up menu, OR when in that mode, there is an additional "Action" (or some such name) button that opens the menu. – ToolmakerSteve Nov 22 '21 at 20:53
  • 1
    Ignoring what @ToolmakerSteve said about usability, which is not the point, you can look at MrGestures for press and hold, https://stackoverflow.com/questions/43569515/how-to-make-long-press-gesture-in-xamarin-forms for longpress, or even TouchEffects from the communitytoolkit, and create your own solution. – Andrei Nov 23 '21 at 09:42

0 Answers0