locked
Duplicate Items in ListView (Windows Phone 8.1)

    Question

  • I have this list view, whose itemsource are generated from IsupportIncrementalLoading implemented class(10 items per iteration).

    <ListView x:Name="parent" ...>
    ...
    <DataTemplate>
    <Grid>
    ...
    <Button Click="button_click" />
    ...
    <ListView x:Name="child">
     ....
    </ListView>
    ..
    </Grid>
    </DataTemplate>

    I have another list view inside the parent list view whose content are generated when the user clicks the element in the parent list view.

    But the problem is when I scrolled down the parent list view, the successive items generated from the listview contains the same childview items that are generated for the previous child listview and it continues for each iteration.

    For example,When I clicked the button in the parent listview item(2nd item), the corresponding child listview item is generated and shown to the user. After I scrolled down the parent listview, the 12th item exactly shows the same child listview items generated for the 2nd listview item and it continues for 22, 32,...

    Any solution to solve this problem?

    I used VisualTreeHelper to get the elements inside the listview

     Grid gr = (Grid)VisualTreeHelper.GetParent(sender as FrameworkElement);
     // ListView childCommentList = XamlHelper.FindElementByName<ListView>(gr, "childCommentList");
     ListView childCommentList = (ListView)VisualTreeHelper.GetChild(gr, 6);
    Saturday, February 21, 2015 8:04 AM

All replies

  • Hi MohanRajk,

    Per my understanding, the method generates the clild listview items may have the same logic for every button call. You should check that method and modify to let it know how to generate different items. Pass a parameter in that method to indicate the item in parent lsitview and generate clild listview item according to the parameter.

    If you don’t know how to do, please post some code snippet about this scenario.

    Regards,


    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.

    Monday, February 23, 2015 3:25 AM
    Moderator
  • Per my understanding, the method generates the clild listview items may have the same logic for every button call.

    The child listiew items of the next parent items are shown, without even the button call. Only the first parent listview button is clicked. Then the replication starts from the next 10th element.
    Friday, February 27, 2015 9:10 PM
  • If you still cannot make it work, can you submit a repro project to show it in detail using your OneDrive?

    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.

    Sunday, March 01, 2015 5:05 AM
    Moderator