-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CustomKanbanModel raises MethodAccessException from base class in the sample project #18
Comments
Another situation: However, if the ObservableCollection does not bind to ItemsSource of Kanban, the exception won't occur. BTW, the data initialization of Kanban is done in the overwrited OnAppearing in code-behind. Appreciate your kind help. Thanks a lot. |
We have checked the reported issue in our SampleBrowser sample with some changes (as you mentioned - added Items inside the OnAppearing method). On that we were able to reproduce the crash issue since BindingContext of Sample is not set. The BindingContext of Sample has been set after the InitializeComponent() of Page. So, before that OnAppearing method invoked and getting null exception on provided model. It has been resolved by setting bindingContext before InitializeComponent as per in below code snippet
And don't forget to add the NotifyPropertyChanged for Model's Data to have a notified on ItemsSource property.
Please check and let us know if you have any concern. |
Sorry for belated reply. Actually I didn't adopt MVVM pattern in the project, so all the logic is in code-behind of the ContentPage. In this situation, the mentioned Exception occurs. I tried to set BindingContext in corresponding Xaml, but it didn't help. I'm wondering if Kanban can function normally if no separate view model class is written. BTW, I used Fody.PropertyChanged to inject RaisePropertyChanged during compilation, so I didn't add the NotifyPropertyChanged explicitly. Many thanks. |
Based on the official demo and above code, the exception still got raised when adding custom kanban model to the observable collection, even when the BindingContext was set. Thanks a lot. System.MethodAccessException: |
Adding an item to ObservableCollection of CustomKanbanModel will raise Exception:
System.MethodAccessException
HResult=0x80131510
Message=Attempt by method 'SampleBrowser.SfKanban.CustomKanbanModel.set_Rating(Single)' to access method 'Syncfusion.SfKanban.XForms.KanbanModel.RaisePropertyChanged(System.String)' failed.
CustomKanbanModel from the sample code is defined as follows:
public class CustomKanbanModel : KanbanModel
{
public float Rating { get; set; }
...
}
Anything wrong here? Thanks.
The text was updated successfully, but these errors were encountered: