Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
A control that enables users to take pictures using the camera on a device.
Use the Camera control to capture pictures with a device's camera. The device must have a camera and the user must authorize the app to use the camera.
Select the camera control to capture a picture from the camera.
The most recently captured picture is available through the Photo property. With this property, the images can be:
Use the Stream, StreamRate, and OnStream properties to automatically capture images on a timer, for example snapping a picture every minute to create a time-lapse sequence.
Captured media is referenced by a text string URI. For more information, read the data type documentation.
Note
The camera control has these limitations:
AvailableDevices – Table of the available cameras on the device.
Table contains two columns:
Note: Not all devices in the table may be usable in your app. Some may be specialized drivers or applications intended for specific purposes.
Camera – The numeric ID of the camera to use. Helpful on devices with more than one camera.
OnStream – Actions to perform when the Stream property is updated.
Photo – The image captured when the user takes a picture.
Stream – Automatically updated image based on the StreamRate property.
StreamRate – How often to update the image on the Stream property, in milliseconds. This value can range from 100 (1/10th of a second) to 3,600,000 (1 hour).
AccessibleLabel – Label for screen readers. Should describe the purpose of taking a picture.
BorderColor – The color of a control's border.
BorderStyle – Whether a control's border is Solid, Dashed, Dotted, or None.
BorderThickness – The thickness of a control's border.
Brightness – How much light the user is likely to perceive in an image.
Contrast – How easily the user can distinguish between similar colors in an image.
DisplayMode – Whether the control allows user input (Edit), only displays data (View), or is disabled (Disabled).
FocusedBorderColor – The color of a control's border when the control is focused.
FocusedBorderThickness – The thickness of a control's border when the control is focused.
Height – The distance between a control's top and bottom edges.
OnSelect – Actions to perform when the user taps or clicks a control.
TabIndex – Keyboard navigation order compared to other controls.
Tooltip – Explanatory text that appears when the user hovers over a control.
Visible – Whether a control appears or is hidden.
Width – The distance between a control's left and right edges.
X – The distance between the left edge of a control and the left edge of its parent container or screen.
Y – The distance between the top edge of a control and the top edge of the parent container or screen.
For these examples, you'll need a device with a camera. To test your app, use a web cam accessible from your browser. Or by saving your app and loading it into an iOS or Android device with a camera.
Add a Camera control.
Authorize the app to use device's camera if prompted.
Add an Image control.
Set the Image property of the Image control to the following formula:
Camera1.Photo
Note
Replace camera control name Camera1 as appropriate.
Press F5 to preview your app.
Take a picture by selecting or tapping the camera control. You should see the result in your image control.
Add a Camera control, name it MyCamera, and set its OnSelect property to this formula:
Collect( MyPix, MyCamera.Photo )
For more information:
Press F5, and then take a picture by selecting or tapping MyCamera.
Add a Vertical gallery control. And then resize its Image control, its template, and the Image gallery control itself to fit in the screen.
Set the Items property of the Image gallery control to this formula:
MyPix
Set the Image property of the Image control in the gallery to this formula:
ThisItem.Url
The picture that you took appears in the Image gallery control.
Take as many pictures as you want, and then return to the default workspace by pressing Esc.
(optional) Set the OnSelect property of the Image control in the Image gallery control to the formula:
Remove( MyPix, ThisItem )
Press F5, and then select a picture to remove it.
Use the SaveData function to save the pictures locally or the Patch function to update a data source.
Add a Camera control.
Authorize the app to use device's camera if prompted.
Set the Items property of the dropdown to:
Camera1.AvailableDevices
Note
Replace camera control name Camera1 as appropriate.
Set Camera property of the camera to:
Dropdown1.Selected.Id
Note
Replace dropdown control name Dropdown1 as appropriate.
Press F5, and then select an item from the dropdown to change the camera.
The camera control shows camera feed and also functions as a button that takes a picture. So, there are similar accessibility considerations as with buttons.
Consider adding an alternative form of input for users with visual disabilities. For example, Add picture to allow users to upload an image from their device.
There must be adequate color contrast between FocusedBorderColor and the outside color.
AccessibleLabel must be present.
TabIndex must be zero or greater so that keyboard users can navigate to it.
Focus indicators must be clearly visible. Use FocusedBorderColor and FocusedBorderThickness to update the visibility of focus indicators.
Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn more