简体   繁体   中英

Image WPF not showing at runtime, after moved MainWindow.xaml

In my application I have moved

  • MainWindow.xaml
  • MainWindow.xaml.cs

to folder app in my project(of course I have changed in my App.xaml StartupUri="app/MainWindow.xaml" ).

After that my Image isn't showing the picture at runtime.:

<Image Source="asd.jpg" HorizontalAlignment="Left" Height="170"  Width="201"/> 

You should also change the source of image to Source="/WpfApplication;component/asd.jpg" :

<Image Source="/WpfApplication;component/asd.jpg" HorizontalAlignment="Left"
       Height="170"  Width="201"/>

WpfApplication is the name of your application.

or

Source="../asd.jpg"

since you need to go one level up in folders now to get the image

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM