This is a migrated thread and some comments may be shown as answers.
Only single property from model displaying
1 Answer 48 Views
This is a migrated thread and some comments may be shown as answers.
jim
Top achievements
Rank 1
jim asked on 26 Feb 2016, 08:57 PM

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
    }

1 Answer, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 01 Mar 2016, 04:59 PM
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
Asked by
jim
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Share this question
or