Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Microsoft Virtual Academy Content

This video is part of a free online course from Microsoft Virtual Academy, click here to view the full course and take advantage of many additional features such as assessments, slides, learning plans and more.

Building Apps for Windows Phone 8.1: (04) Lists and Lists Items in Windows Runtime Apps

34 minutes, 48 seconds

Download

Right click “Save as…”

Get the details on programming lists, formatting list items, and handling long or complex lists effectively in Windows Phone Store apps.

Full course outline:

Follow the Discussion

  • Could you please tell me how to save and restore the listview "scroll position" when no item is selected? Is there a way to access the items that are currently "visible"?

  • arko,

    It's a little roundabout, but you can use the ItemsPanel to find the index of first visible item in the list. From there you can get the container for that item and from that container you can get the item. You can use that item to scroll to the correct position.

    var isp = (ItemsStackPanel)SampleListView.ItemsPanelRoot;
    int firstVisibleItem = isp.FirstVisibleIndex;
    var container = SampleListView.ContainerFromIndex(firstVisibleItem);
    var item = (MyObject)SampleListView.ItemFromContainer(container);
    SampleListView.ScrollIntoView(item);

  • AnandAnand

    Great video! I am developing an app where I am trying to implement pull to refresh functionality using list view. I posted the question on windows Phone forums but haven't received a solution. Can anyone please help me with that.

    http://social.msdn.microsoft.com/Forums/en-US/4e1b69c3-ee92-4d96-8740-2db086e4274b/listview-manipulatindelta-event-not-firing?forum=winappswithcsharp

  • Hello, can you please help me with a better solution to search a Listview OR Gridview. During the search I would like to hide the non matches, and show the matches. I currently have a solution, but its really slow once the list start getting really big.

  • @matthiasS: Thank you. I will try this as soon as I'm finished translating my WP8.0 code to WP8.1.

  • Took me a while to figure out the VB translation of the linq query. Maybe posting it here will save others some time:

    Dim groupedItems As New List(Of KeyedList(Of String, SampleItem))
    
    Dim gruuppi = _
                From item In items
                Order By item.TargetGroup, item.Title
                Group By item.TargetGroup Into itemsByCompany = Group
                Select New KeyedList(Of String, SampleItem)(TargetGroup, itemsByCompany)
    
    groupedItems = gruuppi.ToList
    
    Return groupedItems

    Oh and the source code for these videos can be found at Andy Wigley's OneDrive account [aka.ms/wp81jumpstartdemos].

  • How come the bindings to a CollectionViewSource work fine in run time but not in design time?

    To accomplish "groupedlist" functionality in WP8.1 must I bind to a CollectionViewSource or are there other options with design time support? Surely Microsoft does not expect us to start coding user interfaces blind like one used to before VISUAL studio?

  • arko,

    What I normally do for design-time visuals is create a set of static data that I plan to use at design time and use the "d" designation. Example:

    First add the d xml namespace:

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    Then set d to be ignored on runtime:

    mc:Ignorable="d"

    Then set your design time DataContext in the XAML with the d prefix

    d:DataContext="{Binding MyDesignViewModel}"
    \

    With that, you can use a simple list of lists for design purposes and you won't have to use the CollectionViewSource.

  • @dubem: Without knowing the details of your solution, my guess is that you would actually want to keep all of your items in a "AllItems" collection in your ViewModel and bind your ListView or GridView to a "SearchResultsItems" for the ItemsSource. You could then add or remove the items from that second ObservableCollection in your ViewModel rather than try to do the add-remove within the control.

  • , matthiasS wrote

    -- you can use a simple list of lists for design purposes and you won't have to use the CollectionViewSource.

    This is good news. I had the impression that CVS was a must with "groupedlists".

    Currently I am working on a simple-test-app just to get started. Here is the working xaml and code behind from VS2012-WP8.0-app plus what I have for VS2013-WP8.1-WinRT so far: http://postimg.org/image/5240r5wsx/full/

    The 8.1 app does not work even in runtime. What changes are required to my xaml or code behind as migrating my simple-test-app from 8.0 to 8.1 WinRT?

  • Finally managed to get my grouped list sample working both design and run time.

    Here is the final code: http://postimg.org/image/hfrk4hxux/full

     

  • Dear,

    I downloaded the sample codes and tested them in my Lumia 525 running developer Preview 8.1

    When I run the grouped list view template, the group headed keeps bouncing up and down.

    Is it just me or is it because of the developer preview version of the OS?

    And also I have the feeling that lists in Silverlight apps run much smoother and render much faster.

  • SushmaSushma

    I want to implement panning and zooming in my app,where a user can pan and a zoom a video .How can i do that ?

  • where can I get the project example of this section?

  • @Sushma,

    My recommendation for panning and zooming a video would be to either
    1) Put the video into a Scrollviewer and see if that does it

    2) Use the Player Framework media player (http://playerframework.codeplex.com/) an enormously flexible media player that works on all recent versions of Windows and Windows Phone.

  • @become90:All the code for these projects is available here

    https://onedrive.live.com/?cid=b36de4dd5a9179a1&id=B36DE4DD5A9179A1%2193175&ithint=folder,.zip&authkey=!APluMWf01e3WvqA

  • thanks,


    I got some problem to implement this grouped listview for json file in local folder
    any reference how to use this method for non static data?

  • SasaSasa

    Great video!

    I have been looking a way to change a background of the selected item in ListView. So, when I press the item, the background of that item will change. It sounds simple, but I am confused which to change in the default ItemContainerStyle.

    I presumed the state that I should look into is "pressed". However, when I changed the background, it will only change the background of the tilt animation. How can I remove away the tilt animation and simply change the background of the selected item. FYI, I also set the background of each item in the DataTemplate; well, just in case it would affect the treatment.

    Thank you.

  • @Sasa: Because of the complex nature of the ListView, it uses a ListViewItemPresenter control in the ItemContainerStyle. This controlt has a LOT of brushes attached to it. If you change the SelectedBackground and SelectedPointerOverBackground, that should change the background of the item when it is selected.

    I don't currently see an easy way to remove the tilt, sorry. 

  • Hello everyone!

    I'm a student, I want to create an app that is music player, non-benefit purpose.

    But I can not afford. Guys can give me some help?

    "I want to get all file .mp3 extensions and show it on listview or gridview"

    Thanks guys!

     
     
  • LBNLBN

    how do I get index of item that click in listview(I don not khown whay is allway=-1) my listview is set selectionmode=single

    please?

  • ben0biben0bi

    I just want a list with simple text in it. Please explain EXACTLY how to do that. You explain that as if I knew how to generate a binding and stuff...I DON'T KNOW * about it.

    That line:
    ItemsSource="{Binding Source={StaticResource Items}}"

    is NOT in my ListView when I drag it into my app.

    I don't know how to generate a template or what to do here, please explain that too.

    Thanks.

  • Marios KatsisMarios Katsis

    Very nice video!
    Is there a way to make the Items of the Grouped List View to be scrolled horizontally?

  • Any time you tell me to design my UI by opening up a TEXT EDITOR to enter XAML by hand you have failed me.

    This whole series of videos in unique in that you can spend 30 minutes watching hoping to learn something, but don't really learn anything because you guys just apply things you've already created.

     

     

  • Hello Everyone,

    I want to save some client data with its respective image. For storing image, I've converted bitmap image into byte array and stored that array in database but while displaying all records, I want to display respective image for particular client in list view.

    I've checked example but in that images are coming from folder and not from database. 

    Please share if anyone has example.

    Thanks,

    Hitesh

  • san panditsan pandit

    Hi,
    Thanks for the tutorial its really great video for listview.
    Please tell me how i can make a expandable listview.

    Thanks,
    San K

  • @matthiasS:

    Hi, I cannot download the sample code for these projects,could you please send me a mail of that.

    thanks.

    cceasy@hotmail.com

Remove this comment

Remove this thread

close

Comment on the Post

Already have a Channel 9 account? Please sign in