I don't think this was covered in any tutorial that I've read or done. does any know how is this line works? This is a sample code on how to use sfnumerictextbox, but its default property is object. I need it in double or integer so Inotify came but this line is i don't get. viewModel.Numeric = numericBox.Value == null ? null : (double?)(numericBox.Value); so numeric is equal to null, so what the question mark for? then after question mark is that like if null double perhaps?
And please touch base with Inotifypropertychange.
using System;
using System.ComponentModel;
using Xamarin.Forms;
namespace NumericTextBoxSample
{
// Learn more about making custom code visible in the Xamarin.Forms previewer
// by visiting https://aka.ms/xamarinforms-previewer
[DesignTimeVisible(false)]
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
private void Button_Clicked(object sender, EventArgs e)
{
**viewModel.Numeric = numericBox.Value == null ? null : (double?)(numericBox.Value);**
}
}
public class ViewModel: INotifyPropertyChanged
{
private double? numeric; //checkrain
public double? Numeric //rain
{
get { return numeric; }
set
{
numeric = value;
RaisePropertyChanged("Numeric");
}
}
public event PropertyChangedEventHandler PropertyChanged;
void RaisePropertyChanged(string property)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(property));
}
}
}
}