Posts

Showing posts from July, 2010

Windows Phone 7 - Selecting device photos without PhotoChooserTask

Image
A common feature of mobile based applications is the ability to let you view photos that have been taken with the device. For Silverlight based Windows Phone 7 applications, this functionality would generally be achieved by utilising the PhotoChooserTask.

The PhotoChooser task navigates to the phones photo gallery section, allows the user to select a photo and then returns this photo to the calling application. Now this approach is fine for the majority of circumstances, but what happens if more flexibility is required by the application for image selection? In this case the MediaLibrary class can be utilised to retrieve images from the device, and then displayed in whichever way the application chooses.The following shows simple examples of both approaches.PhotoChooserTask ImplementationHere we have a very simple UI that contains a button to select a photo and a currently unassigned image control.The following code is then used to display the images on the phone.privatevoid butSel…