You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As outlined in our docs 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 MediaCapturedevent. 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.
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.
The text was updated successfully, but these errors were encountered:
For anybody stumbling upon this issue, a functional work-around I'm currently using is the EventToCommandBehavior from the Community Toolkit. This doesn't require any code-behind and propagates the captured media to the ViewModel.
Here is a sample XAML that maps the MediaCaptured event to a command named MediaCapturedCommand:
Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
Current Behavior
As outlined in our docs 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
Anything else?
Additionally I think we may want to consider giving the
CaptureImageCommand
a default value for theCancellationToken
or have an override without it. This makes consuming in XAML a bit harder.The text was updated successfully, but these errors were encountered: