Only single property from model displaying

2 posts, 0 answers
  1. jim
    jim avatar
    1 posts
    Member since:
    Jan 2016

    Posted 26 Feb Link to this post

    Just getting started with a trial and started converting my first form over to use RadDataForm, for some reason, only the last property is showing when I run, seems like its likely layout out on top of each other?  Any help is appreciated.

    Here's my xaml

    <?xml version="1.0" encoding="utf-8" ?>
    <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 xmlns:mvvm="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
                 xmlns:input="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
                 x:Class="AmMac.Calculators.Views.RefinanceCostBenefitAnalysisCalculatorView"
                 mvvm:ViewModelLocator.AutowireViewModel="True" 
                 Title="Refinance Cost Benefit Analysis Calculator - Current Loan - Step 1">
      <input:RadDataForm CommitMode="Immediate" ValidationMode="Immediate"  Source="{Binding Model}"/>
    </ContentPage>

    Here's my model

    public class RefinanceCostBenefitAnalysisCalculatorModel : NotifyPropertyChangedBase
        {
            private decimal _initialLoanAmount;
            [DisplayOptions(Header = "What was your Initial Loan Amount?", PlaceholderText = "Enter Amount",Position = 1)]
            [NonEmptyValidator]
            public decimal InitialLoanAmount
            {
                get
                {
                    return _initialLoanAmount;
                }
                set
                {
                    if (_initialLoanAmount != value)
                    {
                        _initialLoanAmount = value;
                        OnPropertyChanged();
                    }
                }
            }

            private DateTime _actualFirstPaymentDate;
            [DisplayOptions(Header = "When was the Actual First payment date?", PlaceholderText = "Enter First payment date", Position = 2)]
            [NonEmptyValidator]
            public DateTime ActualFirstPaymentDate
            {
                get
                {
                    return _actualFirstPaymentDate;
                }
                set
                {
                    if (_actualFirstPaymentDate != value)
                    {
                        _actualFirstPaymentDate = value;
                        OnPropertyChanged();
                    }
                }
            }

            private int _numberOfPaymentsAlreadyMadeDecimal;
            [DisplayOptions(Header = "How many Payments have you Already Made?", PlaceholderText = "Enter Number of Payments", Position = 3)]
            [NonEmptyValidator]
            public int NumberOfPaymentsAlreadyMade
            {
                get
                {
                    return _numberOfPaymentsAlreadyMadeDecimal;
                }
                set
                {
                    if (_numberOfPaymentsAlreadyMadeDecimal != value)
                    {
                        _numberOfPaymentsAlreadyMadeDecimal = value;
                        OnPropertyChanged();
                    }
                }
            }
        }

    Here's my view model

     

    public class RefinanceCostBenefitAnalysisCalculatorViewModel : BindableBase, INavigationAware
        {
            private readonly INavigationService _navigationService;

            public RefinanceCostBenefitAnalysisCalculatorViewModel(INavigationService navigationService)
            {
                _navigationService = navigationService;
                Model = new RefinanceCostBenefitAnalysisCalculatorModel();

            }

            private RefinanceCostBenefitAnalysisCalculatorModel _model;
            public RefinanceCostBenefitAnalysisCalculatorModel Model
            {
                get { return _model; }
                set { SetProperty(ref _model, value); }
            }

            private bool _nextCommandCanExecute = true;
            public bool NextCommandCanExecute
            {
                get { return _nextCommandCanExecute; }
                set { SetProperty(ref _nextCommandCanExecute, value); }
            }

            public ICommand NextCommand
            {
                get
                {
                    return new DelegateCommand(NextCommandExecute).ObservesCanExecute(p => NextCommandCanExecute); ;
                }
            }

            private void NextCommandExecute()
            {
                _navigationService.Navigate("RefinanceCostBenefitAnalysisCalculatorView2");
            }
            
            #region INavigationAware Implementation

            public void OnNavigatedFrom(NavigationParameters parameters)
            {

            }

            public void OnNavigatedTo(NavigationParameters parameters)
            {

            }

            #endregion
        }

  2. Rosy Topchiyska
    Admin
    Rosy Topchiyska avatar
    551 posts

    Posted 01 Mar Link to this post

    Hi Jim,

    Thank you for contacting us.

    If you register the editor type for the DateTime property, the date editor should appear:
    dataForm.RegisterEditor("ActualFirstPaymentDate", EditorType.DateEditor);

    The data form does not provide an editor that works with decimal values. Here you can see all supported types by the provided editors. If your type is not supported by any editor, you can use a converter. You will also have to register the desired editor type for the decimal property name. I have attached a sample project that could also help you.

    Please, let us know if you have any other questions.

    Regards,
    Rosy Topchiyska
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
Back to Top