Hello,
Welcome to Microsoft Q&A!
1 . OnScanResult
is event
, we can't bind a Command
property to an event .
2 . ScanResultCommand
is a ICommand
without declaring generic type , we can't assign an Action
with parameter to it .
The correct way : bind Result
as well , and get it from ScanResultCommand
in viewmodel .
Xaml
<zxing:ZXingScannerView x:Name="ucZXingScannerView"
IsScanning="True"
IsAnalyzing="True"
Result="{Binding Result}"
ScanResultCommand="{Binding ScanCommand }" />
ViewModel
public class ViewModel
{
public ViewModel()
{
ScanCommand = new Command(OnScanResultCommand);
}
private void OnScanResultCommand()
{
var text = Result.Text;
}
public Result Result { get; set; }
public Command ScanCommand { get; set; }
}
Best Regards,
Cole Xia
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.