2
私はここに画像を表示する上で少し問題があります。UWP App does not show画像
画像はアセットフォルダにあります。私もこのように、プログラムで設定したソースを試してみましたし、画像が表示されていない
<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;
は、私はすでにここに記述されているすべてのものを試してみましたか?
いずれかの相対パスが間違っている、または画像が 'EmbeddedResource'ではありません。 – Herdo
実際には、画像へのパスが正しい場合、 を設定するだけで動作するはずです –
Depechie
パスに間違いがあります。私が を追加すると、Visual Studioのプロジェクト名とフォルダプロジェクトが保存される場所は異なる名前になります。たぶんそれはVisual Studioを悩ましているものです... –
KOmrAD