locked
ListView Manipulation

    Question

  • In my ContentGrid, there is a ListView which lists some items of a category. Then how to do this: by swiping the ListView horizontally and repeatly, the items of other categories will be list on the ListView one (category) by one?

    Thinking the data model as the following:

    public class Book
    {
       public int ID {get;set;}
       public string Name {get;set;}
       public int CategoryID {get;set;}
       .....
    }

    Thanks



    • Edited by imnbwd Wednesday, January 21, 2015 10:02 AM
    Wednesday, January 21, 2015 3:02 AM

All replies

  • Hi imnbwd,

    To make the listview horizontally, you can set orientation of the itempanel like this:

            <ItemsPanelTemplate x:Key="ItemsPanelTemplate">
                <ItemsStackPanel Orientation="Horizontal" />
            </ItemsPanelTemplate>

    CarouselPanel class is used to repeat the items but I don't think it works with ListView, I think you may use ObserverableCollection for help range the listview items.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, January 21, 2015 7:38 AM
    Moderator
  • Hi, Jamles, Thanks for your answer. While I think that you may misunderstand my mean of "horizontally", it is to describe the direction of the action (swipe or manipulation) on ListView.
    Wednesday, January 21, 2015 9:57 AM
  • Thanks for your explanation, however I'm still confused about what is your scenario.

    I may understand you would like to implement something: ListView act as the main index page, by select the category (swipe the item), the detail things will list on the ListView.

    However I'm not able to know why its other category items will be shown one by one: "the items of other categories will be list on the ListView one (category) by one".

    Could you explain in more detail so that we can have a better understanding.

     --James

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 22, 2015 6:32 AM
    Moderator
  • OK, so let us think about Pivot, when we swipe on it,  pivot pages will be cyclically changing. Assume each PivotItem represents a category, its name is PivotItem.Header, and all items of this category are list on this PivotItem and as its Content (PivotItem.Content). By swiping, different pivot pages (PivotItem) will show us categories of data cyclically (or what I mean "one by one"), this effect is what I want.

    Based on the concept of Pivot, here I do not want to use Pivot, but use basic controls and layout like the following:

                        <Grid x:Name="ContentGrid">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <!--"be treated as pivotitem header"-->
                            <TextBlock Text="{Binding CategoryName}" FontSize="28" />
                            <!-- "be treated as pivotitem content"-->
                            <ListView Grid.Row="1">
                                
                            </ListView>
                        </Grid>

     

    So, this is my question, how can I swipe on this ListView to change the current category(include category name in TextBlock and its items in ListView) to next category? 

    BTW, my difficulties are mainly about the Manipulation property setting for control and how to process the corresponding Manipulation event to achieve this effect.

    Thanks very much.







    • Edited by imnbwd Thursday, January 22, 2015 10:04 AM
    Thursday, January 22, 2015 9:55 AM