This is a migrated thread and some comments may be shown as answers.

Hurdles on 'CellEditingEnded' event on DataGrid when we have Checkbox on DataTemplate

7 Answers 82 Views
GridView
This is a migrated thread and some comments may be shown as answers.
gautham
Top achievements
Rank 1
gautham asked on 15 Nov 2010, 07:19 PM

Hello,

 

I have attached a behavior on Datagrid; it has ‘CellEditingEnded’ event. It works fine when I place the Combobox, Textbox, and Autocompletebox inside the Datatemplate.

 

Problem:

The ‘CellEditingEnded’ event will not fire, when I place the Checkbox control inside Datatemplate.

 

My Code Snippet:

public class UpdateValueBehavior : Behavior<RadGridView>
       {
              protected override void OnAttached()
              {
                     base.OnAttached();
                     this.AssociatedObject.CellEditEnded += new EventHandler<
                GridViewCellEditEndedEventArgs>(AssociatedObject_CellEditEnded);
              }
  
              void AssociatedObject_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)
              {
                   // my logic
              }
       }

Regards,
Gautham

7 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 16 Nov 2010, 08:01 AM
Hi,

 Can you post more info about your grid version?

Regards,
Vlad
the Telerik team
See What's New in RadControls for Silverlight in Q3 2010 on Tuesday, November 16, 2010 11:00 AM - 12:00 PM EST or 10:00 PM - 11:00 PM EST: Register here>>
0
gautham
Top achievements
Rank 1
answered on 16 Nov 2010, 08:13 AM

Hello Vlad,

My gridVersion:

  

    Assembly Telerik.Windows.Controls.GridView.dll, v2.0.50727 

 

Regards

 Gautham

0
Vlad
Telerik team
answered on 16 Nov 2010, 08:28 AM
Hello,

 This is the framework version - not the grid version. 

All the best,
Vlad
the Telerik team
See What's New in RadControls for Silverlight in Q3 2010 on Tuesday, November 16, 2010 11:00 AM - 12:00 PM EST or 10:00 PM - 11:00 PM EST: Register here>>
0
gautham
Top achievements
Rank 1
answered on 16 Nov 2010, 08:44 AM
Hello,

 > DataGrid Version: 2010.2 812

My code snippet:

                  <syncControls:GridViewDataColumn.CellTemplate>
  <DataTemplate>
  <syncControls:CheckBox IsChecked="{Binding IsAllowToDispatch, Mode=TwoWay}"/>
</DataTemplate>
</syncControls:GridViewDataColumn.CellTemplate>
<syncControls:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<syncControls:CheckBox IsChecked="{Binding IsAllowToDispatch, Mode=TwoWay}"/>
</DataTemplate>
</syncControls:GridViewDataColumn.CellEditTemplate>

Problem: It will work fine when the 'checkbox' is in edit mode, 
but when I just click using mouse button. This event will not fire.

Regards,
Gautham
0
Yavor Georgiev
Telerik team
answered on 18 Nov 2010, 12:47 PM
Hello gautham,

 If you place a CheckBox in the CellTemplate of a GridViewColumn, you will be able to manipulate the CheckBox directly, without entering edit mode in RadGridView. Without entering edit mode, the CellEditEnded event will not fire. I propose to set the IsReadOnly property of the CheckBox in the CellTemplate to true, so that clicking it will enter edit mode and display the CheckBox in the CellEditTemplate. This way, when the CheckBox is manipulated, the CellEditEnded event will fire.

Regards,
Yavor Georgiev
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
gautham
Top achievements
Rank 1
answered on 19 Nov 2010, 07:47 AM
Hello,

 But, we don't have a ReadOnly Property for checkbox, so I made  used of 'ISEnabled' property. Please help to customize the checkbox by implementing an another property 'ReadOnly'

Anyway this is very useful solution.


Regards,
Gautham
0
Anand
Top achievements
Rank 1
answered on 22 Aug 2012, 03:38 PM
Yavor ,Could not able to implement your solution. Can you post code  ?

Anand
Tags
GridView
Asked by
gautham
Top achievements
Rank 1
Answers by
Vlad
Telerik team
gautham
Top achievements
Rank 1
Yavor Georgiev
Telerik team
Anand
Top achievements
Rank 1
Share this question
or