Udostępnij za pośrednictwem


How to: Add Images to a WPF Project

You can add an image to your Windows Presentation Foundation (WPF) project by using the Image control. You assign the image by setting the Source property in the Properties window.

To add an image to a WPF project

  1. From the Toolbox, drag an Image control onto the Window.

  2. In the Properties window, locate the Source property and then click the ellipsis button (...) in the right column.

    The Choose image dialog box appears. If the project has embedded images, they are displayed.

    Choose image dialog box

  3. Click Add.

    The Open dialog box appears.

  4. Navigate to a folder that contains image files.

  5. Select one or more image files and click Open.

    The selected images are displayed in the Choose image dialog box. In addition, an Images folder is created within the project, and the images are copied into it.

  6. Select an image and click OK.

  7. The selected image appears in the Image control. The Source property is assigned with the correct image URI syntax.

See Also

Reference

Image

Other Resources

Working with the WPF Designer