Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to download the file, parse it, display as a list, make the displayed list items clickable with clicks triggering navigation to the details view of your collection item and have a search box, right?</p> <ol> <li>To download the file - you could use WebClient.DownloadStringAsync</li> <li>To parse it - you could use string.Split('\n') and string.Split(',')</li> <li><p>To display as list - you would put the parsed objects representing csv file rows in a collection - like a List, then use a ListBox control and set its ItemsSource to that list. Additionally you would need to define the ItemTemplate to display the strings in two columns, eg.</p> <pre><code>&lt;ListBox.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;!-- The DataContext here is a string array, so binding to [i] will bind to its string at position i --&gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;TextBlock Text="{Binding [0]}" Width="240" TextWrapping="Wrap"/&gt; &lt;TextBlock Text="{Binding [1]}" Width="240" TextWrapping="Wrap"/&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; &lt;/ListBox.ItemTemplate&gt; </code></pre></li> <li><p>To handle clicks - the best way would be to use Buttons with Command-bindings, but the simple solution works OK too - you just handle ListBox.SelectionChanged event and the SelectedItem is what was clicked - you have to override OnNavigated in your page and set ListBox.SelectedItem back to null when you navigate back there to allow clicking the same item again.</p></li> <li>To navigate to another page with all the details - you can call NavigationService.Navigate(new Uri(string.Format("/DetailsPage.xaml?col1={0}&amp;col2={1}&amp;col3={2}&amp;col4={3}", Uri.EscapeUriString(((string[])(lb.SelectedItem))[0]), ... [1,2,3]), UriKind.Relative), then parse the Uri in OnNavigatedTo override of the DetailsPage class.</li> <li>To allow searches in the ListBox you would use a <a href="http://msdn.microsoft.com/en-us/library/system.windows.data.collectionviewsource%28v=VS.95%29.aspx" rel="nofollow">CollectionViewSource</a> object as the ItemsSource of the ListBox and allow the user to enter <a href="http://www.geoffhudik.com/tech/2010/10/14/wp7-in-app-searching-filtering.html" rel="nofollow">search</a> queries that would update the Filter causing the contents of the ListBox to refresh.</li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload