WPF images cannot be displayed (WPF background images cannot be displayed)

Source: Internet
Author: User

I am currently working on WPF development and have encountered image display problems. Now I will explain the solution.

1. Double-click the resources. resx file of the project, and click Add resource on the left-side interface to add images, as shown in.

2. After the image is successfully added, the resources folder is automatically generated, and the added resource files are listed in the folder. If not, you can compile the project, as shown in.

3. Select the resources folder image, right click, and select properties. In the Properties window below, set build action to resource and clear the project and re-compile it.

4. The page code is as follows. lyncsmsapp is the project name, and "component/resource file name/image name" is used as the template for modification.

5. Final Results

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.