图像正在MainPage中工作,但我正在尝试将其集成到导航面板Templete中,图像不会显示.任何人都可以建议我可能是什么问题.
Templete正在使用FRAMES,但这不应该是问题.
XAML代码
<Button Grid.Column="0" Style="{StaticResource NavigationButtonStyle}">
<StackPanel Orientation="Horizontal">
<Image Source="Assets/donut-icon.png" Style="{StaticResource IconImageStyle}" />
<TextBlock Text="Donut" Foreground="White" />
</StackPanel>
</Button>
样式资源
<Style targettype="Image" x:Key="IconImageStyle">
<Setter Property="Height" Value="20" />
<Setter Property="Width" Value="20" />
<Setter Property="Margin" Value="0,10,0" />
</Style>
我注意到您的页面位于“Pages / Go Nuts”文件夹中,因此您应该使用以下URI来获取图像.
<Image Source="ms-appx:///Assets/donut-icon.png" />
要么
<Image Source="/Assets/donut-icon.png" />
使用< Image Source =“Assets / donut-icon.png”/>它将搜索当前文件夹中的资源.但是当前文件夹中没有这样的资源,所以它不起作用.