C# 多页c中的隔离存储#

C# 多页c中的隔离存储#,c#,windows-phone-8.1,iso,C#,Windows Phone 8.1,Iso,我已经在应用程序中创建了两个页面。。。 在首页Tkstpeix上写下您进入存储器时的姓名,并在此页上设置应用程序, 而当你进入第二页的时候,应用程序名就不出来了 例如: 当我打开应用程序并输入我的名字“Ibra”时,第二页上的文本框“我的名字”不会出现 ->第1页: using myProject.Model; public partial class Test1 : PhoneApplicationPage { IsolatedStorageSettings Data = Isolat

我已经在应用程序中创建了两个页面。。。 在首页Tkstpeix上写下您进入存储器时的姓名,并在此页上设置应用程序, 而当你进入第二页的时候,应用程序名就不出来了

例如: 当我打开应用程序并输入我的名字“Ibra”时,第二页上的文本框“我的名字”不会出现

->第1页:

using myProject.Model;
public partial class Test1 : PhoneApplicationPage
{
    IsolatedStorageSettings Data = IsolatedStorageSettings.ApplicationSettings;
    List<UserData> ObjUserDataList = new List<UserData>();
    public Test1()
    {
        InitializeComponent();
        this.Loaded += Test1_Loaded;
    }

    private void Test1_Loaded(object sender, RoutedEventArgs e)
    {
        if (Data.Contains("UserNameData"))
        {
            NavigationService.Navigate(new Uri("/Test2.xaml", UriKind.Relative));
        }
    }

    private void NameBox_GotFocus(object sender, RoutedEventArgs e)
    {
        TextBox tb = (TextBox)sender;
        tb.BorderBrush = new SolidColorBrush(Colors.LightGray);
    }

    private void button_Click(object sender, RoutedEventArgs e)
    {
        Data["UserNameData"] = NameBox.Text;
        NavigationService.Navigate(new Uri("/Test2.xaml", UriKind.Relative));
    }
}
注:
我在windows phone 8.1 silverlight中工作

您将
DataContext
设置为
ObjUserData
,但您从未为
ObjUserData.UserName添加任何内容,因此返回为空

using myProject.Model;
public partial class Test2 : PhoneApplicationPage
{
    IsolatedStorageSettings Data = IsolatedStorageSettings.ApplicationSettings;
    UserData ObjUserData = new UserData();
    public Test2()
    {
        InitializeComponent();
        this.Loaded += Test2_Loaded;
    }

    private void Test2_Loaded(object sender, RoutedEventArgs e)
    {
        if (Data.Contains("UserNameData"))
        {

            StckUserDetailsUI.DataContext = ObjUserData;
        }
    }
}


<StackPanel  Name="StckUserDetailsUI"  Grid.Row="0" Margin="12,17,0,28" Grid.ColumnSpan="2">
            <TextBlock Text="Your Details :" Foreground="White" FontSize="30" TextDecorations="Underline"/>
            <TextBlock FontSize="40" Name="TxtUserName" Text="{Binding UserName}" Foreground="White"/>
        </StackPanel>
 class UserData
{
    public string UserName { get; set; }
}