Click here to Skip to main content
15,889,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there,

I have a GridView with a datasource with a potentially infinite library of items. GridView handles this nicely by only loading what is required. My issue is this. If I want to quickly get to all my items that begin with the letter "P", how can I quickly navigate there without scrolling through everything along the way? Fortunately, I can know the exact index of the item, even though it is not yet loaded into the model. I need to somehow navigate to that index.

I have achieved this rather horribly with something along these lines:

C#
Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Low,
                async () =>
                {
                    string letter = "N";
                    object item = null;
                    while (item == null)
                    {
                        item = this.Library.Items.FirstOrDefault(i => (i as Book).Title.StartsWith(letter));
                        this.Library.ScrollIntoView((item ?? this.Library.Items.LastOrDefault()));
                    }
                });


Any ideas would be great.

Thanks,
Dom
Posted
Comments
bowlturner 5-Jun-14 13:56pm    
why don't you just use a filter on the datasource?
DominicZA 5-Jun-14 18:44pm    
Well, lets carry on from that example. That jump to the letter N, then realize they meant to go to M, so they begin to move backwards through the GridView, but the only data in there is the letter N.
bowlturner 6-Jun-14 9:01am    
It all depends on how you implement it. if you have a text box (or something similar) to filer the list as the user types, allowing them to see immediately the changes, as long as you are not removing the focus of the input they can quickly change what they are looking for as well as see what they are filtering on.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900