Reputation: 1
I am creating a Xamarin.Forms application and have run into an issue as I plan the UI. I have a form that I need to display a value which can be one of several (over 80 choices). A ListView on the Form is not practical as the user must be able to select from several top level groupings to get to an actual selectable item. For example:
Category 1> Sub Category 1-1> Option 1... Option 12 Sub Category 1-2> Option 13... Option 20 Category 2> Sub Category 2-1> Option 21... Option 35 Sub Category 2-2> Option 36... Option 50 Category N> Sub Category N-1> ....... Sub Category N-X> .......
I have a page that lists each of the Categories, then (once selected) each of the Sub Categories, then ultimately the options.
My question is: In this scenario, what is the best approach to displaying the blank form (I tried an Entry control, but can't find a way to navigate to the selection page by clicking on it) and then the selected value in the form.
Ideally, the UI would look like an Entry control and would open up the selection page once the user taps the Entry control. This seems like a fairly simple (and probably common) approach, so I feel like I must be missing something basic.
Thanks in advance!
Upvotes: 0
Views: 584
Reputation: 2325
In my app, I have a huge search-page with various ListViews, where the user can select one Item (out of until 4'000) or multiple items.
I have implemented this by using Buttons (select xx) and then show a PopUp-Control (from XLabs).
With the PopUp-Control, you don't need to call further pages, what will make easier the whole logic:-).
On the PopUp, I the show an entry and a ListView.
As soon as the user types text in the entry, the List (Datasource to the ListView) is filtered "on-the-fly" to the typed text.
This works fine, even with 4'000 List-entry's.
So.. I would suggest you to solve your problem on this way.
Every time a character is added, I create a new list by the typed text and re-assign it to the ListView.
So you can e.g. put more then one entry on the PopUp and then filter the List for more the one value at the same time or maybe show the categories one after one...
You can find more information's to the PopUp-control here:
Hope this helps...
Upvotes: 0
Reputation: 1123
A Button in Xamarin.Forms does give you the Clicked event or the bindable Command property that can be bound to the ViewModel to handle the logic.
Unfortunately, an Entry object does not have a 'focussed' event or similar. However, this can be easily achieved through creating a custom Entry subclass and writing a customer Renderer for it. This would allow you to create a Focussed bindable property for use (see http://developer.xamarin.com/guides/cross-platform/xamarin-forms/custom-renderer/ for examples and tips).
Upvotes: 0
Reputation: 89204
I would use a Button and a Label, where tapping the button launches a Modal with the select ListView, and once you've completed the selection the value is displayed in the Label.
Upvotes: 0