Problem with Compiled bindings used with C# #26145
-
I followed the Compiled bindings can be used with C# and replaced the Binding with the following implementation, but during runtime, the app crashes due to a Binding issue. there's a problem with the current implementation?
Exception:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 10 replies
-
@simonrozsival I don't quite understand why there is no implementation here. |
Beta Was this translation helpful? Give feedback.
-
QRScanPageViewModel.cs
Views-QRScanPage.xaml.cs-GeneratedBindingInterceptors-49-28.g.cs:line 59
|
Beta Was this translation helpful? Give feedback.
-
Note with cameraView.SetBinding(IsVisibleProperty, Binding.Create(static (QRScanPageViewModel vm) => vm.HasCameraPermission.Value, mode:BindingMode.OneWay, source: BindingContext));
cameraView.SetBinding(IsEnabledProperty, Binding.Create(static (QRScanPageViewModel vm) => vm.HasCameraPermission.Value, mode: BindingMode.OneWay, source: BindingContext));
cameraView.SetBinding(CameraView.IsScanningProperty, Binding.Create(static (QRScanPageViewModel vm) => vm.IsScanning.Value, mode: BindingMode.OneWay, source: BindingContext));
cameraView.SetBinding(CameraView.OnDetectedCommandProperty, Binding.Create(static (QRScanPageViewModel vm) => vm.ScanResultCommand, , mode: BindingMode.OneWay, source: BindingContext)); And with cameraView.SetBinding(IsVisibleProperty, BindingBase.Create<QRScanPageViewModel, bool>(static (QRScanPageViewModel vm) => vm.HasCameraPermission.Value, mode:BindingMode.OneWay, source: BindingContext));
cameraView.SetBinding(IsEnabledProperty, BindingBase.Create<QRScanPageViewModel, bool>(static (QRScanPageViewModel vm) => vm.HasCameraPermission.Value, mode: BindingMode.OneWay, source: BindingContext));
cameraView.SetBinding(CameraView.IsScanningProperty, BindingBase.Create<QRScanPageViewModel, bool>(static (QRScanPageViewModel vm) => vm.IsScanning.Value, mode: BindingMode.OneWay, source: BindingContext));
cameraView.SetBinding(CameraView.OnDetectedCommandProperty, BindingBase.Create<QRScanPageViewModel, bool>(static (QRScanPageViewModel vm) => vm.ScanResultCommand, , mode: BindingMode.OneWay, source: BindingContext)); |
Beta Was this translation helpful? Give feedback.
That's interesting. As a workaround, setting
BindingMode.OneWay
should make the problem go away:I would be interested in seeing the definition of
OnDetectedCommandProperty
(and its defaultBindingMode
). Is theCameraView
a class you own or does it come from some third-party library?