Here’s a link demonstrating how to migrate Longlistselector from Windows Phone 8 to Windows Phone 8.1, it works for you because it shows you how it works in version 8.0.
http://www.visuallylocated.com/post/2014/04/28/Migrating-from-the-LongListSelector-to-the-ListView-in-Windows-Phone-XAML-Apps.aspx
Already in the part of passing parameters from one page to the other, you do the following: You add the event SelectionChanged
within the ListBox
populated with contacts. Then on the page you want to show the details, do the following: (in the example I named DetalhesContato.xaml
)
First you need to create a property of the type of class you are using for contacts, in the example I use Contato
, leave it as global.
//Tanto na MainPage.xaml.cs quanto na DetalhesContato.xaml.cs
//crie a propriedade
public Contato contato { get; set; }
So in the method OnNavigatedTo
you fill the screen components
//DetalhesContato.xaml.cs
protected override void OnNavigatedTo(NavigationEventArgs e)
{
textBlockNome.Text = contato.Nome;
textBlockTelefone.Text = contato.Telefone;
//etc
}
Already in the MainPage.xaml.cs
you treat the event SelectionChanged
//Mainpage.xaml.cs
private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
Contato c = (sender as ListBox).SelectedItem as Contato;
//Salva o contato na propriedade da classe, para ser enviado
this.contato = c;
this.NavigationService.Navigate(
new Uri("/DetalhesContato.xaml", UriKind.Relative));
}
To pass the contact object to the next page, use the method OnNavigatedFrom
//Mainpage.xaml.cs
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
//Recupera a próxima página
DetalhesContato page = e.Content as DetalhesContato
//é preciso que seja o mesmo nome da propriedade que vc criou no DetalhesContato.xaml.cs
page.contato = this.contato;
}
By then I knew Felipe! My problem is that it will have to be a Longlistselector and by clicking on the "block" will move to the next screen with more data from the "person".
– Renan Serrão Nogueira
But thank you so much for the start! It’s already very helpful!
– Renan Serrão Nogueira
Right, but what’s the difference then? The click event you can use onHold for example. Take a look here: https://msdn.microsoft.com/en-us/library/microsoft.phone.controls.longlistselector(v=vs.105). aspx
– Felipe Bonezi
But I could do it this way in what way? Can you indicate me some step-by-step? In other words, leave practically the same layout.
– Renan Serrão Nogueira
up try to solve
– Renan Serrão Nogueira