简体   繁体   中英

how to get image url from my project image folder?

My requirement to get image from images folder from my current stimulation explore.

在此处输入图片说明

we need access image from Images folder.

My code is gives an error at ImageSource MoleImage = new BitmapImage(new Uri(".Images/Section5Q4femail1.pngeMole")); line

private Image CreateImage()
    {
        Image Mole = new Image();
        Mole.Width = 25;
        Mole.Height = 25;
        ImageSource MoleImage = new BitmapImage(new Uri(".Images/Section5Q4femail1.pngeMole"));
        Mole.Source = MoleImage;
        return Mole;
    }

Create Uri object like this

new Uri("/Earnest_Individuals;component/Images/Section5Q4femail1.pngeMole");

where Earnest_Individuals is your project assembly name.

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