Passer un paramètre à une form Windows Phone

by Stéphane 6. August 2011 06:34

Voici comment naviger vers une page dans une application Windows Phone.

Naviguer vers une page se fait via la code suivant:

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

Pour passer un paramètre, il suffit d'utiliser la notation "?Param=value" :

NavigationService.Navigate(new Uri("/ContactDetail.xaml?ID=1234", UriKind.Relative));

Pour récupérer ce paramètre dans la page ContactDetail:

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            String id = NavigationContext.QueryString["ID"];
}

Tags:

Windows Phone 7

blog comments powered by Disqus

Stéphane Schwartz, Chef de projet (IPMA Level-C) et développeur (MCSD.Net)

Linkedin Twitter

International Project Management Association

Microsoft Certified Technology Specialist Microsoft Certified Application Developer Microsoft Certified Solution Developer

AdSense

Month List

Powered by BlogEngine.NET 2.0.0.36 - Eco Theme by n3o Web Designers