0
votes

On a Panorama page I have an LongListSelector with some products. When the user clicks on an item I want to add it to another LongListSelector on the next Panorama Item. If the user clicks on the same item I will display the quantity on a TextBlock and not add it again to the next list. I don't know how to start it. I've already added the items on the first list.

Any thoughts? Thanks in advance.

2

2 Answers

0
votes

When the user tap on an item in the list, in the SelectionChanged event, you'll get the selected item's object. Then, add this item to the list2 with a check that whether it is present in the list2 already or not.

LongListSelectorSelectionChanged()

  - if(SelectedItem in LIST2)

    Display quantity in the textbox
    return

  - else 

    Add the SelectedItem in the LIST2
    return

I hope your List2 is a ViewModel binded to the paranoma viewl so that the view will be changed as soon as an item is added to the List2.

1
votes

I would handle that too in a selectionchanged event.

the easiest way for giving data to the next page is the parametervalue:

NavigationService.Navigate(new Uri("/SecondPage.xaml?msg=JSONSTRING", UriKind.Relative));

Maybe serialize the Object to a JSON-String pass it over like ahead and desirialize it on the new page again to your object:

    protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
    {
        base.OnNavigatedTo(e);
        String productsJSON = NavigationContext.QueryString["msg"];
        YourProducts product = JsonConvert.DeserializeObject<YourProducts>(productsJSON);

or do you mean a panoramaItem within the same panoramapage?