IT tutorials
 
Mobile
 

Windows Phone 8 : XAML Overview - Images

1/24/2013 5:43:44 PM
- Windows 10 Product Activation Keys Free 2019 (All Versions)
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire

Although the simple vector drawing stack is invaluable to the design of your Windows Phone 7 application, you will always need to use images in your application. The simple Image element is used to display images in your application:

<Image Source="http://wildermuth.com/images/headshot.jpg" />

The Image element supports JPEG and PNG files. It does not support GIF files. By specifying the Source attribute, the Image element shows the picture you specify in the URI of the source. Specifying an Internet URI, the Image element will attempt to download the image from the Internet location. The Source attribute supports a relative URI as well:

<Image Source="headshot.jpg" />

By using a relative URI, the Image element attempts to download the image from the application itself. You can add an existing image to the Windows Phone project by simply selecting Add | Existing Item from the Project menu. Once you have the image as part of the project, it will be packaged with your application. Therefore, you can simply use the relative URI to specify the Source attribute. The relative URI is relative to the root of the project. So if you were to put an image in a project folder, the URI would navigate to the path:

<Image Source="Images/headshot.jpg" />

Storing your images as part of the application is typical for static images (e.g., button icons, backgrounds, etc.).

By default, the Image element is set to stretch the image to fit the size of the element. You can stretch images by specifying the Stretch attribute. The valid types of stretch include

None: No stretching is performed.

Uniform: Stretches the image, preserving the original aspect ratio, to fit within the frame of the Image element. This is the default.

UniformToFill: Stretches the image, preserving the original aspect ratio, to fill the Image element. If the aspect ratio of the Image element is different from that image, the image will be clipped to accommodate the difference.

Fill: Stretches the image to fill the Image element without preserving the aspect ratio.

Figure 1 illustrates examples of the different stretch types.

Figure 1. Image stretching

Image

When creating Image elements you can simply specify the Stretch attribute, like so:

<Image Source="Images/headshot.jpg" Stretch="UniformToFill" />

Because the Image element is just part of the design grammar, you can specify size either by using height and width or by using container properties like any other element (e.g., Grid.Row/Column, Margin, VerticalAlignment, etc.).

 
Others
 
- Mobile Web Development with WordPress, Joomla!, and Drupal : PRIMARY SITE CONTENT (part 3) - Forms
- Mobile Web Development with WordPress, Joomla!, and Drupal : PRIMARY SITE CONTENT (part 2) - Embedding Images and Media
- Mobile Web Development with WordPress, Joomla!, and Drupal : PRIMARY SITE CONTENT (part 1) - Text and Typography, Pagination
- BlackBerry Bold 9700 and 9650 Series : Email Set Up - Setting Up Email for the First Time
- BlackBerry Bold 9700 and 9650 Series : Email Set Up - Learn Your BlackBerry and Getting Around
- Enter Java ME on Symbian OS : Java ME Management on Devices (part 2)
- Enter Java ME on Symbian OS : Java ME Management on Devices (part 1) - MIDP Security Settings
- iphone Programming : Handling Data - Parsing XML
- iphone Programming : Handling Data - Data Entry
- The BlackBerry Mobile Data System : Configuring MDS
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
programming4us programming4us
 
Popular tags
 
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS