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"/>
这里ImageSource=“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文件夹中