0

newbie question, actually questions

for instances: i have 10 chapters and each chapter contains few paragraph text content, i'm trying to build a listbox to list all characters and when the item selected, it displays related text

  1. i'm tring to use the SelectionChangedEventArgs for listbox to navigate a new xaml page where displays textblock text, is that proper? or there's a more efficient way?
  2. i'm having trouble to display the text dynamically in the xaml page where contains the textblock control, how do i pass a parameter from the selected listbox to the textblock xaml page, then dynamically display the text?

tks

Joe Lu
  • 2,240
  • 1
  • 15
  • 18

1 Answers1

0

To pass parameter fom one to other page

Navigating page:

string str= lstbox.selectedItem
page.NavigationService.Navigate(new Uri("/Views/Page.xaml?parameter="+str, UriKind..Relative));

In the destination page:

string parameter = string.Empty;
if (NavigationContext.QueryString.TryGetValue("parameter", out parameter)) {
    this.label.Text = parameter;
}

If you are having any confusion than use this link :

http://stackoverflow.com/questions/12444816/how-to-pass-values-parameters-between-xaml-pages
Pradeep Kesharwani
  • 1,480
  • 1
  • 12
  • 21