Hi,
I need to be able to work with Nullable Doubles for these types of editors. I've migrated from Infragistics to Telerik. Infragistics has a nice Spin Editor in their masked edit editor which I am missing here.
However, I am having trouble with Bindings and using nulls. In my scenario, I have added the masked edit and spinner to a form.I have created the following class to bind to:
class MyClass : INotifyPropertyChanged
{
private double? _summit; public event PropertyChangedEventHandler PropertyChanged;
public double? Summit
{
get { return _summit; }
set { _summit = value; OnPropertyChanged("Summit"); }
} private double? _spinMe;
public double? SpinMe
{
get { return _spinMe; }
set { _spinMe = value; OnPropertyChanged("SpinMe"); }
}
protected void OnPropertyChanged(string name)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}
}
I am declaring a form field as follows:
MyClass myclassinstance = new MyClass();
I am calling the following in form load:
myclassinstance.Summit = 123.987;
myclassinstance.SpinMe = 101.21;
this.radMaskedEditBox1.DataBindings.Add("Value", myclassinstance, "Summit", false, DataSourceUpdateMode.OnValidation);
this.radSpinEditor1.DataBindings.Add("Value", myclassinstance, "SpinMe", false, DataSourceUpdateMode.OnValidation);
I have a button that displays the values when clicked.When the form shows, the masked edit for summit shows 123.987. The spin editor shows 0.00.
When I click the button, this shows the 2 values as initialized - 123.987 and 101.21.
If I blank the spin then it reverts to 0.00. Clicking the button shows the value as 101.21.
If I blank the masked edit and click on the button the value is still 123.987.
If I type a value into the spin edit then I need to understand how I can use binding with these nullable doubles correctly.
I can't see any nice Telerik examples of these and thought the community may benefit and I need help ASAP - I thought without opening a support case. Appologies if I have missed anything.
Thanks
Andez
I need to be able to work with Nullable Doubles for these types of editors. I've migrated from Infragistics to Telerik. Infragistics has a nice Spin Editor in their masked edit editor which I am missing here.
However, I am having trouble with Bindings and using nulls. In my scenario, I have added the masked edit and spinner to a form.I have created the following class to bind to:
class MyClass : INotifyPropertyChanged
{
private double? _summit; public event PropertyChangedEventHandler PropertyChanged;
public double? Summit
{
get { return _summit; }
set { _summit = value; OnPropertyChanged("Summit"); }
} private double? _spinMe;
public double? SpinMe
{
get { return _spinMe; }
set { _spinMe = value; OnPropertyChanged("SpinMe"); }
}
protected void OnPropertyChanged(string name)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}
}
I am declaring a form field as follows:
MyClass myclassinstance = new MyClass();
I am calling the following in form load:
myclassinstance.Summit = 123.987;
myclassinstance.SpinMe = 101.21;
this.radMaskedEditBox1.DataBindings.Add("Value", myclassinstance, "Summit", false, DataSourceUpdateMode.OnValidation);
this.radSpinEditor1.DataBindings.Add("Value", myclassinstance, "SpinMe", false, DataSourceUpdateMode.OnValidation);
I have a button that displays the values when clicked.When the form shows, the masked edit for summit shows 123.987. The spin editor shows 0.00.
When I click the button, this shows the 2 values as initialized - 123.987 and 101.21.
If I blank the spin then it reverts to 0.00. Clicking the button shows the value as 101.21.
If I blank the masked edit and click on the button the value is still 123.987.
If I type a value into the spin edit then I need to understand how I can use binding with these nullable doubles correctly.
I can't see any nice Telerik examples of these and thought the community may benefit and I need help ASAP - I thought without opening a support case. Appologies if I have missed anything.
Thanks
Andez