CommunityToolkit / CommunityToolkit/Maui

[BUG] Cannot capture image with CameraView using just MVVM

Open
#1,993 4 comments 6 reactions 0 assignees View on GitHub
bug Camera 📸
Dominant language
C#
Stars
2.7k
Forks
500
Avg merge
2d 14h
Merged PRs (30d)
7

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Did you read the "Reporting a bug" section on Contributing file?

- [X] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug

### Current Behavior

As outlined in [our docs](https://learn.microsoft.com/dotnet/communitytoolkit/maui/views/camera-view?tabs=ios#captureimage) we can use the `CaptureImageCommand` to capture an image while using the MVVM pattern in our .NET MAUI app.

However, to access the actual media that was captured we need to subscribe to the `MediaCaptured` _event_. And by having to use an event suddenly I am breaking the MVVM pattern.

### Expected Behavior

We need to have a way of also capturing the media in an MVVM fashion to not force people into bad patterns.

### Steps To Reproduce

N/A

### Link to public reproduction project repository

https://github.com/CommunityToolkit/Maui

### Environment

```markdown
- .NET MAUI CommunityToolkit Camera: 1.0.2
- OS: N/A
- .NET MAUI: 8.0.61
```

### Anything else?

Additionally I think we may want to consider giving the `CaptureImageCommand` a default value for the `CancellationToken` or have an override without it. This makes consuming in XAML a bit harder.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.