I’ve been having some fun building an app for my Windows Phone this weekend using Azure Mobile Services. I wanted to do some stuff with photos as well by uploading them to Azure Storage as blobs. The camera seems to default to the maximum resolution when using it in code so I wanted to set it to something smaller like 640 * 480 to make the size of the images smaller.
There is a nice code sample here of how to do it:
But when I placed this code in the OnNavigatedTo method of my xaml page I was getting an error. Seems the way to get this to work off the bat is to make use of the camera_Initialized event. So in OnNavigatedTo add:
camera = new PhotoCamera();
camera.Initialized += camera_Initialized;
and in the camera_Initialized event you can change the resolution:
Size res = camera.AvailableResolutions.ElementAt(0);
camera.Resolution = res;
Hope this saves someone some time…!