I am trying to implement simple NumericColumn using RadNumericUpDown. The problem is that value of the Numeric does not get updated if I bind it to integer property. Binding to decimal works great.
Here's my source code:
I am using the RadControls for Silverlight Q1 2010 SP1 Relese.
Sincerely,
Szymon Wantuch
Here's my source code:
public class NumericColumn : GridViewBoundColumnBase |
{ |
public bool IsInteger |
{ |
get { return (bool)GetValue(IsIntegerProperty); } |
set { SetValue(IsIntegerProperty, value); } |
} |
public static readonly DependencyProperty IsIntegerProperty = |
DependencyProperty.Register("IsInteger", typeof(bool), typeof(NumericColumn), null); |
public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem) |
{ |
this.BindingTarget = RadNumericUpDown.ValueProperty; |
var numeric = new RadNumericUpDown(); |
numeric.IsInteger = this.IsInteger; |
numeric.SetBinding(this.BindingTarget, this.CreateValueBinding()); |
return numeric; |
} |
private Binding CreateValueBinding() |
{ |
var valueBinding = new Binding(); |
valueBinding.Mode = BindingMode.TwoWay; |
valueBinding.NotifyOnValidationError = true; |
valueBinding.ValidatesOnExceptions = true; |
valueBinding.UpdateSourceTrigger = UpdateSourceTrigger.Explicit; |
valueBinding.Path = new PropertyPath(this.DataMemberBinding.Path.Path); |
return valueBinding; |
} |
} |
I am using the RadControls for Silverlight Q1 2010 SP1 Relese.
Sincerely,
Szymon Wantuch