The advantage of the PhotoCamera class is that it gives control over the flash and autofocus when capturing images.

PhotoCamera is usually defined as a field in a page or viewmodel and then instantiated when needed. The device camera needs time to ready itself for use and cannot be used until it is initialized, indicated by an Initialized event. Initialization commences when the PhotoCamera is assigned to the source of a VideoBrush, using its SetSource method.


Failure to call VideoBrush.SetSource with the PhotoCamera instance prevents the Initialized event from being raised.

The following example shows how to create and initialize a PhotoCamera using a VideoBrush within a PhoneApplicationPage:

Get Windows® Phone 8 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.