To reproduce:
Add a RadSpinEditor and set its Hexadecimal property to true. Set its maximum to 0xFFFFFFFF(4294967295). Try to enter value larger than 7FFFFFFF(Int.MaxValue). You will notice that the value cannot be set.
Workaround:
public class MySpinEditor : RadSpinEditor
{
public new MySpinElement SpinElement
{
get
{
return base.SpinElement as MySpinElement;
}
private set
{
typeof(RadSpinEditor).GetField("spinElement", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(this, value);
}
}
protected override void CreateChildItems(RadElement parent)
{
this.SpinElement = new MySpinElement();
this.SpinElement.RightToLeft = this.RightToLeft == System.Windows.Forms.RightToLeft.Yes;
this.RootElement.Children.Add(this.SpinElement);
this.SpinElement.ValueChanging += SpinElement_ValueChanging;
this.SpinElement.ValueChanged += SpinElement_ValueChanged;
this.SpinElement.TextChanging += SpinElement_TextChanging;
this.SpinElement.KeyDown += SpinElement_KeyDown;
this.SpinElement.KeyPress += SpinElement_KeyPress;
this.SpinElement.KeyUp += SpinElement_KeyUp;
}
void SpinElement_KeyUp(object sender, KeyEventArgs e)
{
this.CallBaseOnKeyUp(e);
}
void SpinElement_KeyPress(object sender, KeyPressEventArgs e)
{
this.CallBaseOnKeyPress(e);
}
void SpinElement_KeyDown(object sender, KeyEventArgs e)
{
this.CallBaseOnKeyDown(e);
}
void SpinElement_TextChanging(object sender, TextChangingEventArgs e)
{
this.OnTextChanged(e);
}
void SpinElement_ValueChanged(object sender, EventArgs e)
{
this.OnValueChanged(e);
}
void SpinElement_ValueChanging(object sender, ValueChangingEventArgs e)
{
this.OnValueChanging(e);
}
}
public class MySpinElement : RadSpinElement
{
protected override decimal GetValueFromText()
{
try
{
if (!string.IsNullOrEmpty(this.Text) && ((this.Text.Length != 1) || (this.Text != "-")))
{
decimal resultValue = 0m;
if (this.Hexadecimal)
{
resultValue = this.Constrain(Convert.ToDecimal(Convert.ToInt64(this.Text, 16)));
}
else
{
resultValue = this.Constrain(decimal.Parse(this.Text, CultureInfo.CurrentCulture));
}
return resultValue;
}
else
{
return this.internalValue;
}
}
catch
{
return this.internalValue;
}
}
protected override Type ThemeEffectiveType
{
get
{
return typeof(RadSpinElement);
}
}
}