This question is locked. New answers and comments are not allowed.
Hi,
I have a simple custom cell with a button and a text box
this is the code of the custom control , that will be used in edit mode
BTW - while debugging this, events are called the values are being updated correctly
this user control is bound to a column
Now... the problem!
everything is displayed correctly , but, after i finish editing the column data ,
i have a CellEditEnded event for post processing the values
and in that event
e.OldData // get the old value correctly
e.NewData // this is null !!
any idea how to resolve this .. ?
Alon
(using the SL 2010 version)
string oldValue = .ToString();
I have a simple custom cell with a button and a text box
this is the code of the custom control , that will be used in edit mode
| public static readonly DependencyProperty SelectedTextProperty = |
| DependencyProperty.Register("SelectedText", typeof(String), typeof(AsteaButtonFieldCtl), |
| new PropertyMetadata(null, OnSelectedTextChanged)); |
| public AsteaButtonFieldCtl() |
| { |
| InitializeComponent(); |
| } |
| public String SelectedText |
| { |
| get { return (String) this.GetValue(SelectedTextProperty); } |
| set { this.SetValue(SelectedTextProperty, value); } |
| } |
| private static void OnSelectedTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
| { |
| var ctl = (AsteaButtonFieldCtl)d; |
| ctl.NewTextUpdate((string)e.NewValue); |
| } |
| private void NewTextUpdate(string newText) |
| { |
| this.txt.Text = newText; |
| } |
| private void btn_Click(object sender, RoutedEventArgs e) |
| { |
| //nothing right now |
| } |
| private void txt_TextChanged(object sender, TextChangedEventArgs e) |
| { |
| this.SelectedText = txt.Text; |
| } |
BTW - while debugging this, events are called the values are being updated correctly
this user control is bound to a column
| public override FrameworkElement CreateCellEditElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem) |
| { |
| var lookupCtl = new AsteaButtonFieldCtl(); |
| lookupCtl.SetBinding(AsteaButtonFieldCtl.SelectedTextProperty, this.CreateValueBinding()); |
| return lookupCtl; |
| } |
| 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; |
| } |
Now... the problem!
everything is displayed correctly , but, after i finish editing the column data ,
i have a CellEditEnded event for post processing the values
and in that event
e.OldData // get the old value correctly
e.NewData // this is null !!
any idea how to resolve this .. ?
Alon
(using the SL 2010 version)
string oldValue = .ToString();