2017-11-03 1 views
2

이미지를 표시하는 데 약간의 문제가 있습니다.UWP 응용 프로그램이 표시되지 않습니다.

이미지는 자산 폴더에 있습니다. 나는 또한이 같은 프로그램 상 설정 소스를 시도하고 이미지가 표시되지

<Page 
    x:Class="MyApp.WelcomeScreen" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="using:MyApp" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" Width="800" Height="480" RequestedTheme="Dark"> 

    <Grid Background="#C4043F"> 
     <Image Name="MyPicture" Source="/Assets/LOGO.png" HorizontalAlignment="Left" VerticalAlignment="Top"/> 
    </Grid> 
</Page> 

: 여기 내 XAML 코드입니다. try-catch 블록을 넣으려고했지만 예외가 발생하지 않았습니다. UWP - Image Uri in Application Folder

내가 무엇을 놓치고 :

string imagePath = "ms-appx:///Assets/LOGO.png"; 
BitmapImage bitmapImage = new BitmapImage(new Uri(imagePath)); 
MyPicture.Source = bitmapImage; 

는 이미 여기에 설명 된 모든 것을 시도?

1) 빌드 작업내용으로 설정됩니다

+0

어느 상대 경로가 잘못, 또는 이미지가'EmbeddedResource' 없습니다. – Herdo

+0

실제로 이미지 경로가 맞으면 가 작동해야합니다. – Depechie

+0

경로에 문제가 있습니다. . 을 추가하면 Visual Studio의 프로젝트 이름 및 폴더 프로젝트가 저장되는 곳은 다른 이름입니다. 어쩌면 그것은 Visual Studio를 괴롭 히고 있습니다. – KOmrAD

답변

2

이 단계를 따르십시오.

2) 그리고 항상 을 설정하려고 ** 이미지 속성에서 출력 디렉터리 "에 복사합니다.

Screenshot

관련 문제