0
Answer

Windows Phone App Listview to change from page 1 to page 2

Alex Biddle

Alex Biddle

10y
645
1
I have a listview on my page 1 which when clicked on i.e. listview item 1 when clicked an image appears, this also happens with another item and what i want is for when they have clicked the value in the listview for them to be brought to another page when clicking on the picture that appeared where text is describing the picture that popped up in the first page
 
 
For example, in listview item 1 when clicked an image of Jk Rowling appears to the right and if the user clicks on that image they go to the second page (which is working fine) but when i click on the picture on the first page i want text to load into the textbox that i have created on the second page so the user sees a long description about that author. (So i want different text to appear depending on what listview item the user has chosen)
 
Below is my code
 
FIRST PAGE
 
namespace PhoneApp1
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();

}

public void AuthorList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (AuthorList.SelectedIndex == 1)
{

BitmapImage Dostoyevsky = new BitmapImage(new Uri("dostoyevsky.jpg",UriKind.Relative));
AuthorImage.Source = Dostoyevsky;
AuthordescriptionText.Text = @"Born: 11 November 1821
Died: February 9 1881 of Epilepsy, Emphysema

Dostoyesky is one of the greats of Russian literature with novels such as Crime and Punishment, The Idiot
Demons and The Brothers Karamazov";


}
else if (AuthorList.SelectedIndex == 2)
{
BitmapImage Tolstoy = new BitmapImage(new Uri("tolstoy.jpg", UriKind.Relative));
AuthorImage.Source = Tolstoy;

AuthordescriptionText.Text = @"Born: 9 September 1828
Died: 20 November 1910 (Pneumonia)
Tolstoy is usually remembered as the man who created the masterpiece
War & Peace which is over 1000 pages, his other works include Anna karanina and his trilogy Childhood, boyhood
and youth which is based on his experiences in the Crimean war";


}

else if (AuthorList.SelectedIndex == 3)
{
BitmapImage Turgenev = new BitmapImage(new Uri("turgenev.jpg", UriKind.Relative));
AuthorImage.Source = Turgenev;


}

}

private void GoToAuthorPage(object sender, RoutedEventArgs e)
{

}

public void ImageTapTodifferent(object sender, GestureEventArgs e)
{
if (AuthorList.SelectedIndex == 1)
{





}
NavigationService.Navigate(new Uri("/AuthorPage.xaml", UriKind.Relative));

}

private void UpdateImage(object sender, EventArgs e)
{
AuthordescriptionText.Opacity = 50;
}



protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
{

}

}
}
 
SECOND PAGE
 
namespace PhoneApp1
{
public partial class AuthorPage : PhoneApplicationPage
{
public AuthorPage()
{
InitializeComponent();
}





private void BackButton(object sender, RoutedEventArgs e)
{

NavigationService.GoBack();



}



private void OnTapAuthorPage(object sender, System.Windows.Input.GestureEventArgs e)
{



AuthorDescrptionLong.Text = @"

Quote: If you want to be happy, be.

Tolstoy was the youngest of 5 children of an upper class family
he attended the University of Kazan but soon left to live at his ancestral
home which he been given part inheritance for. In 1848 Tolstoy moved to
Moscow where he became embroiled in a life full of gambling, this is also
the time when Tolstoy wrote his first story called 'Childhood' which is about
the life of a young boy in 1800 Russia.
Tolstoy married Sofya Andreyevna while married Tolstoy created his
books which fought for the title of being his Magnum Opus, War & Peace and Anna
Karenina.

Tolstoy grew long tired with society as a whole as it deemed true happiness
to be heralded in fancy clothing and expensive clothes and constant lust
which Tolstoy deplored. He instated that true happiness comes from emotional
and religious commitments and decided to share his property and funds with
his family, stop drinking liquor and only ate vegetables.";
}
}