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
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