Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/300.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Windows Phone 8 Silverlight不在第二页加载新图像_C#_Image_Silverlight_Windows Phone 8 - Fatal编程技术网

C# Windows Phone 8 Silverlight不在第二页加载新图像

C# Windows Phone 8 Silverlight不在第二页加载新图像,c#,image,silverlight,windows-phone-8,C#,Image,Silverlight,Windows Phone 8,我正在开发一个windowsphone8.1silverlight应用程序 我有一个问题: 当用户尝试打开新页面时,请使用: NavigationService.Navigate(新Uri(“/Views/Menu.xaml”,UriKind.Relative)) 页面正常打开,但我无法加载新图像,我只能使用我在第一页上使用的图像 第一页XAML: <Grid x:Name="LayoutRoot" Background="#f3f3f4"> <!--TitlePan

我正在开发一个
windowsphone8.1silverlight
应用程序

我有一个问题:

当用户尝试打开新页面时,请使用:

NavigationService.Navigate(新Uri(“/Views/Menu.xaml”,UriKind.Relative))

页面正常打开,但我无法加载新图像,我只能使用我在
第一页上使用的图像


第一页XAML:

<Grid x:Name="LayoutRoot" Background="#f3f3f4">

    <!--TitlePanel contains the name of the application and page title-->
    <StackPanel x:Name="LogoPanel" Grid.Row="0" Margin="12,120,0,28">
        <Image Height="100" Source="Assets/Logo.png"/>
    </StackPanel>

    <StackPanel x:Name="LogoPanel1" Grid.Row="0" Margin="12,400,0,28">
        <TextBox x:Name="txtUsername" Height="72" TextWrapping="Wrap" TextAlignment="Center" Text="Username" Foreground="#A7A5A8" GotFocus="TextBox_GotFocus" LostFocus="txtUsername_LostFocus"/>
        <PasswordBox x:Name="txtPassword" Height="72" Password="password"   HorizontalAlignment="Center" Foreground="#A7A5A8" Width="468" Style="{StaticResource PasswordBoxStyle1}" LostFocus="txtPassword_LostFocus" GotFocus="txtPassword_GotFocus"/>
        <Button Content="LOGIN" Background="#18a689" Click="Button_Click"/>
    </StackPanel>
</Grid>
<Grid x:Name="LayoutRoot" Background="#f3f3f4">
    <Grid.RowDefinitions>
        <RowDefinition Height="200" />
    </Grid.RowDefinitions>
    <!--TitlePanel contains the name of the application and page title-->
    <StackPanel x:Name="userPanel" Height="200" Grid.Row="0" Margin="0,0,0,0" Background="#18a689">
        <Grid x:Name="userGrid">
            <Grid.RowDefinitions>
                <RowDefinition Height="200" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <!-- User Image -->
            <Image Grid.Row="0" Grid.Column="0" Height="178" Source="Assets/User.png"/>

            <!-- User Info -->
            <TextBlock Grid.Column="1" HorizontalAlignment="Left" Margin="0,60,0,0" TextWrapping="Wrap" Text="Ricardo Sampaio" VerticalAlignment="Top" FontSize="24" FontWeight="Bold"/>
            <TextBlock Grid.Column="1" HorizontalAlignment="Left" Margin="0,100,0,0" TextWrapping="Wrap" Text="rsampaio@hydra.pt" VerticalAlignment="Top" FontSize="24"/>
        </Grid>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
    </Grid>
</Grid>
<Image Height="100" Source="Assets/Logo.png"/>
<Image Grid.Row="0" Grid.Column="0" Height="178" Source="Assets/User.png"/>

有人能帮我吗?

第一页XAML:

<Grid x:Name="LayoutRoot" Background="#f3f3f4">

    <!--TitlePanel contains the name of the application and page title-->
    <StackPanel x:Name="LogoPanel" Grid.Row="0" Margin="12,120,0,28">
        <Image Height="100" Source="Assets/Logo.png"/>
    </StackPanel>

    <StackPanel x:Name="LogoPanel1" Grid.Row="0" Margin="12,400,0,28">
        <TextBox x:Name="txtUsername" Height="72" TextWrapping="Wrap" TextAlignment="Center" Text="Username" Foreground="#A7A5A8" GotFocus="TextBox_GotFocus" LostFocus="txtUsername_LostFocus"/>
        <PasswordBox x:Name="txtPassword" Height="72" Password="password"   HorizontalAlignment="Center" Foreground="#A7A5A8" Width="468" Style="{StaticResource PasswordBoxStyle1}" LostFocus="txtPassword_LostFocus" GotFocus="txtPassword_GotFocus"/>
        <Button Content="LOGIN" Background="#18a689" Click="Button_Click"/>
    </StackPanel>
</Grid>
<Grid x:Name="LayoutRoot" Background="#f3f3f4">
    <Grid.RowDefinitions>
        <RowDefinition Height="200" />
    </Grid.RowDefinitions>
    <!--TitlePanel contains the name of the application and page title-->
    <StackPanel x:Name="userPanel" Height="200" Grid.Row="0" Margin="0,0,0,0" Background="#18a689">
        <Grid x:Name="userGrid">
            <Grid.RowDefinitions>
                <RowDefinition Height="200" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <!-- User Image -->
            <Image Grid.Row="0" Grid.Column="0" Height="178" Source="Assets/User.png"/>

            <!-- User Info -->
            <TextBlock Grid.Column="1" HorizontalAlignment="Left" Margin="0,60,0,0" TextWrapping="Wrap" Text="Ricardo Sampaio" VerticalAlignment="Top" FontSize="24" FontWeight="Bold"/>
            <TextBlock Grid.Column="1" HorizontalAlignment="Left" Margin="0,100,0,0" TextWrapping="Wrap" Text="rsampaio@hydra.pt" VerticalAlignment="Top" FontSize="24"/>
        </Grid>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
    </Grid>
</Grid>
<Image Height="100" Source="Assets/Logo.png"/>
<Image Grid.Row="0" Grid.Column="0" Height="178" Source="Assets/User.png"/>
这里Image
Source=“Assets/User.png”

检查您的
Assets文件夹
是否有
User.png
图像退出

第二页XAML编辑:

<Image Grid.Row="0" Grid.Column="0" Height="178" Source="/Assets/User.png"/>

您好,请在XAML文件的Assets/User.png之前添加/(斜杠)

如下

<Image Grid.Row="0" Grid.Column="0" Height="178" Source="/Assets/User.png"/>


如果将
Assets/User.png
放在第1页上,您确定会加载它吗?将您的cs文件code@smoothersillentsillent ok:)@Agostinhob07您的cs文件中的图像显示/绑定代码在哪里?@SmootherSleent我只是在屏幕上显示图像是的User.png存在如果我尝试在第一页显示它我没有问题检查您的XAML
第一页
第二页
路径。它是否在同一文件夹中?
?第二个文件在/Views文件夹中