Meilleur auteur de réponses
Page vide après une Navigate

Question
-
Bonjour,
Je suis en train de réaliser une application universelle sous Windows 10 et lorsque je j'essaye de naviguer sur une seconde page celle-ci est vide .
je clique sur un bouton qui appelle une commande grâce au binding qui appelle
currentFrame.Navigate(typeof(ConnexionView)); //avec ou sans params c'est la même currentFrame.Navigate(typeof(ConnexionView), UserInfos);
public class ConnexionView : Page { public UserData UserInfos { get; private set; } public ConnexionView() { DataContext = this; Debug.WriteLine("/////////////////////////////////////////////"); } protected override void OnNavigatedTo(NavigationEventArgs e) { UserInfos = (UserData)(e.Parameter); Debug.WriteLine(UserInfos.Cover.UriSource.ToString()); } }
(Le binding marche il y a pas de soucis à ce niveau la)
Je ne passe pas par le constructeur de la ConnexionView.
Lorsque j'utilise un breakpoint pour regarder le content de ma frime c'est bien ConnexionView mais toutes les valeurs de ConnexionView sont null ou zero...
Je débute donc s'il y a des choses aberrantes je suis la pour apprendre :D
Merci
Thomas
- Modifié magicthoto_bx lundi 28 septembre 2015 15:32
Réponses
-
Contrairement à ce que je vous disais précédemment, il faut ajouter une Blank Page. Voilà le code-behind que j'obtiens lorsque j'ajoute une Blank Page :
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 namespace App8 { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class BlankPage1 : Page { public BlankPage1() { this.InitializeComponent(); } } }
Je n'obtiens pas la même chose que vous. Pouvez-vous essayer en créer une nouvelle page ?
- Marqué comme réponse magicthoto_bx mardi 29 septembre 2015 13:37
Toutes les réponses
-
-
-
-
oui
ConnexionPage.xaml
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:MoodBoxSandBox" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:DataContext="using:MoodBoxSandBox.DataContext" x:Class="MoodBoxSandBox.ConnexionPage" mc:Ignorable="d" NavigationCacheMode="Enabled"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="41*"/> <RowDefinition Height="178*"/> <RowDefinition Height="120"/> <RowDefinition Height="48*"/> <RowDefinition Height="5*"/> <RowDefinition Height="48*"/> <RowDefinition Height="48*"/> <RowDefinition Height="65*"/> <RowDefinition Height="48*"/> <RowDefinition Height="25*"/> <RowDefinition Height="48*"/> <RowDefinition Height="60*"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition Width="45"/> <ColumnDefinition Width="45"/> <ColumnDefinition Width="150"/> <ColumnDefinition Width="45"/> <ColumnDefinition Width="45"/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Rectangle Grid.ColumnSpan="7" Grid.RowSpan="12" Fill="#FF6870FF"/> <Image x:Name="image" Grid.Column="3" Margin="0" Grid.Row="1" Source="{Binding UserCover.UriSource, Mode=TwoWay}"> <Image.DataContext> <DataContext:AuthentificationContext/> </Image.DataContext> </Image> </Grid> </Page>
ConnexionPage.xaml.cs
using MoodBoxSandBox.User; using System.Diagnostics; using Windows.UI.Xaml.Controls; namespace MoodBoxSandBox.View { public class ConnexionPage : Page { public UserData UserInfos { get; private set; } public ConnexionPage() { DataContext = this; Debug.WriteLine("/////////////////////"); } } }
-
Contrairement à ce que je vous disais précédemment, il faut ajouter une Blank Page. Voilà le code-behind que j'obtiens lorsque j'ajoute une Blank Page :
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 namespace App8 { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class BlankPage1 : Page { public BlankPage1() { this.InitializeComponent(); } } }
Je n'obtiens pas la même chose que vous. Pouvez-vous essayer en créer une nouvelle page ?
- Marqué comme réponse magicthoto_bx mardi 29 septembre 2015 13:37
-