[Prism] How to save an integer?

stesvisstesvis USMember ✭✭✭
edited November 2017 in Xamarin.Forms

So I am biding my form to a Prism property, "Person", and I need to save an integer property of Person:

        private Person _person;
        public Person Person
            get { return _person; }
            set { SetProperty(ref _person, value); }


public class Person
        public int? Age { get; set; }

and the XAML looks like this:

<EntryCell Label="Age" Text="{Binding Person.Age}"></EntryCell>

But when I save the form, Person.Age is always null, I guess because it expects an int but it's getting a string.

How could I pass the value I type in and get it to save properly?

It seems like I have to implement a IValueConverter, can anyone provide an example, and how to use it in the EntryCell?

Sign In or Register to comment.