How to: Assign an Image to an Image Control
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
You can display an image in your Windows Presentation Foundation (WPF) application by using the Image control. This topic shows how to add an image resource to your project and display it by using the WPF Designer for Visual Studio.
To assign an image by using the Properties window
In Solution Explorer, right-click your WPF project, point to Add, and then select Existing Item….
The Add Existing Item dialog box opens.
In the Add Existing Item dialog box, set the type drop-down list to display images files and navigate to the image that you want to display.
Select the image and click Add.
The image is added to the project.
In Solution Explorer, select the image file.
In the Properties window, make sure that the Build Action property is set to Resource.
Add an Image control to the design surface.
In the Properties window, click the Source property for the Image control.
Select the image that you added from the drop-down list.
Your image is displayed in the Image control.
To assign an image by using pack URI syntax
- Use XAML view to set the Source property of the Image control to a pack URI. For more information, see Pack URIs in WPF.