![](/img/trans.png)
[英]Transformation (rotation) of image using matrix - design-time vs. run-time rendering results
[英]<Image /> displays image at design-time but not at runtime; why?
我正在嘗試將圖像插入Windows Store應用程序,並且它在設計時出現在XAML編輯器中,但是在運行時該圖像沒有出現。
我很確定我在這里使用了正確的代碼,並且已經將徽標添加到Assets文件夾中,但是在運行時它仍然沒有出現。 如果我對代碼或Assets文件夾有誤,那么在設計時它甚至都不會出現在編輯器中,我想這有什么用呢?
XAML:
<Page
x:Class="AppName.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:AppName"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Image Source="Assets\Logos\16380.png"
Stretch="None"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="120, 0, 0, 0"
/>
</Grid>
</Page>
我已經設法解決了這個問題。
在XAML中的頁面上插入圖像時,需要在解決方案資源管理器中右鍵單擊圖像文件,單擊“屬性”,然后確保將其“生成操作”設置為“內容”,然后將“復制到輸出目錄”設置為“復制”(如果較新)。 您還需要使用正斜杠(/)而不是反斜杠()。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.