PhotoCamera Class

PhotoCamera Class

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Provides the basic camera functionality for a Windows Phone still camera application. This class includes members for enabling and configuring functionality such as image capture, focus, resolution, and flash mode. Also, it provides events for camera focus, image capture, and image availability.


Namespace:  Microsoft.Devices
Assembly:  Microsoft.Phone (in Microsoft.Phone.dll)
XMLNS for XAML: Not mapped to an xmlns.

Public NotInheritable Class PhotoCamera _
	Inherits Camera
<PhotoCamera .../>

The PhotoCamera type exposes the following members.

Public methodPhotoCameraInitializes a new instance of the PhotoCamera class.
Public methodPhotoCamera(CameraType)Initializes a new instance of the PhotoCamera class for the specified type of camera.

Public propertyAvailableResolutionsQueries the camera for the available resolutions. (Inherited from Camera.)
Public propertyCameraTypeGets the type of camera that the Camera object represents; indicates the location of the camera on the device. (Inherited from Camera.)
Public propertyFlashModeGets or sets the flash mode. Unsupported flash modes silently default to Off.
Public propertyIsFocusAtPointSupportedSpecifies whether the camera can programmatically auto focus on a specific point in the viewfinder.
Public propertyIsFocusSupportedSpecifies whether the camera can be auto-focused programmatically.
Public propertyOrientationGets the number of degrees that the viewfinder brush needs to be rotated clockwise to align with the camera sensor. (Inherited from Camera.)
Public propertyPreviewResolutionGets the current resolution of the image provided by the PhotoCameraGetPreviewBuffer methods. This method is for use by the live viewfinder. (Inherited from Camera.)
Public propertyResolutionGets or sets the resolution of the image captured by the camera. (Inherited from Camera.)
Public propertyYCbCrPixelLayoutGets the YCbCr pixel layout of the camera preview buffer.

Public methodCancelFocusCancels the current focus operation.
Public methodCaptureImageInitiates a full-resolution capture of the current image displayed in the viewfinder.
Public methodDisposeDisposes of the image source stream and frees resources used by the Camera object. (Inherited from Camera.)
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeReleases unmanaged resources and performs other cleanup operations before the Camera object is reclaimed by garbage collection. (Inherited from Camera.)
Public methodFocusStarts a camera auto focus operation.
Public methodFocusAtPointStarts a camera auto focus operation on a specific point in the viewfinder, for those devices that support it.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetPreviewBufferArgb32Copies the current viewfinder ARGB frame into a buffer for further manipulation.
Public methodGetPreviewBufferYCopies the luminance data for the current viewfinder frame into a buffer for further manipulation.
Public methodGetPreviewBufferYCbCrCopies the current viewfinder frame into a buffer for further manipulation.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIsFlashModeSupportedDetermines whether a particular flash mode is supported on the device.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

Public eventAutoFocusCompletedOccurs after the focus operation is complete.
Public eventCaptureCompletedOccurs when the capture sequence is complete.
Public eventCaptureImageAvailableOccurs when an image is available.
Public eventCaptureStartedOccurs when the capture sequence has started.
Public eventCaptureThumbnailAvailableOccurs when a thumbnail image is available.
Public eventInitializedOccurs when the camera object has been initialized. (Inherited from Camera.)

To account for the Windows Phone execution model, initialize the PhotoCamera object in the OnNavigatedTo(NavigationEventArgs) method and explicitly call the camera Dispose method during the OnNavigatingFrom(NavigatingCancelEventArgs) method. Add event handlers for PhotoCamera and CameraButtons events in the OnNavigatedTo(NavigationEventArgs) method and remove them in the OnNavigatingFrom(NavigatingCancelEventArgs) method.

For examples and more information about how to implement these members, see How to create a base camera app for Windows Phone 8.

Important noteImportant Note:

multiple devices If photo capture is not a core feature of your application, consider using the Camera Capture Task to capture photos instead of using the camera APIs directly. Memory allocated for the Camera Capture Task does not count toward total application memory use. This helps minimize your application’s memory use, which is particularly important when your application runs on a lower-memory device. For more information, see Developing apps for lower-memory phones for Windows Phone 8 and How to use the camera capture task for Windows Phone 8.


If you use this API in your app, you must specify the following capabilities in the app manifest. Otherwise, your app might not work correctly or it might exit unexpectedly.


Windows Phone 8, Windows Phone OS 7.1

For more info, see App capabilities and hardware requirements for Windows Phone 8.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

© 2017 Microsoft