Can a double-tap gesture be used on an Entry control so as to do something other than edit the text?

DaveBoggustDaveBoggust USMember, University ✭✭

I have an Entry control on a form that I can type a date into which is validated by a behavior and that works fine. I also have an invisible (to save screen real estate) DatePicker on the form that I would like to show itself (by giving it focus) if I double-click on the Entry control (I've added a 2-tap gesture to it) so that the user can pick a date rather than type one. The problem is that unless I'm doing something wrong, both a single- and double-tap gesture just allow the user to edit the text content as normal. Should it be possible to detect a double-tap on an Entry control too? Or do I need to create a custom control?

Answers

  • rene_ruppertrene_ruppert DEXamarin Team, University, XamUProfessors Xamurai

    Yes, you'll need a custom renderer for the entry field. I don't know about Android but for iOS it'll require you to subclass UITextField and hack around the default behaviors.

    However I strongly discourage doing this. UI controls have well defined behaviors on each platform and double tapping one is nothing I would ever expect to pop up some date picker. Why don't you create a user control which is an entry field and a button next to it (with a calendar icon maybe) and the button brings up the date picker?

  • DaveBoggustDaveBoggust USMember, University ✭✭

    The requirement is for the user to be able to type in a date and alternatively to be able to select one using a calendar picker if desired. However, due to limited screen real estate (there's a lot on the screen) and concerns about the small size of the calendar icon and big fingers, I was asked to see if I could make both the icon AND the Entry field bring up the picker with a single-click. To manually type in a date the user would double-tap in the Entry field. Does that make sense?

  • rene_ruppertrene_ruppert DEXamarin Team, University, XamUProfessors Xamurai

    I'd say: try to fix the root issue instead of inventing uncommon UI/UX solutions. If there's too much on the screen, it's not well designed for a mobile app. My 2 cents :-)

Sign In or Register to comment.