Using telerikInput:RadDataForm with PRISM MVVM
1 Answer 8 Views
UMP
Top achievements
Rank 1
Iron
UMP asked on 07 Jun 2021, 12:03 PM | edited on 08 Jun 2021, 12:08 AM

hi good days to all,

i go through example source code here  https://github.com/telerik/telerik-xamarin-forms-samples/blob/master/QSF/QSF/Examples/DataFormControl/ReservationsExample/DataFormView.xaml.cs

validation is done through code behind :


private void DoneButton_Clicked(object sender, EventArgs e)
        {
            this.dataForm.FormValidationCompleted += DataForm_FormValidationCompleted;
            this.dataForm.ValidateAll();
        }

I'm using command binding in button to call delegate command in mvvm.  Is it  possible to call ValidateAll() from within mvvm or specific method to achieve this ? 

1 Answer, 1 is accepted

Sort by
0
UMP
Top achievements
Rank 1
Iron
answered on 08 Jun 2021, 12:06 AM

   

private async void DataFormValidationCompleted(object sender, FormValidationCompletedEventArgs e) { if (e.IsValid) { // call method DCSubmit to submit data for backend using Refit.

var ctx = (PrismDeathCompensationPageViewModel)this.BindingContext; ctx.DCSubmit(); } }

i'm callling viewmodel method from codebehind and its working now.  prism:ViewModelLocator.AutowireViewModel="True"
Asked by
UMP
Top achievements
Rank 1
Iron
Answers by
UMP
Top achievements
Rank 1
Iron
Share this question
or