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

Checking whether a Silverlight DataGridCell is editable or not

1 Answer 62 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 04 Oct 2011, 03:48 PM
Hi ,

Using the Sentence Verification Builder, I am trying to check if a standard Silverlight DataGridCell has become editable after pressing the F2 button and non-editable after I click on the Escape button. Unfortunately, I dont see isEditing in the list of properties. I cross checked with the Telerik API reference and was surprised to see that the ArtOfTest.WebAii.Silverlight.UI.DataGridCell object doesnt support this property.  The isEnabled property returns True in both cases (after pressing F2 as well as Escape).

Any ideas how this can be achieved?

Regards,
Rahul

1 Answer, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 04 Oct 2011, 07:00 PM
Hello Rahul,

There is no "IsEditing" property of a Silverlight DataGridCell for us to use. The native out of the box Silverlight DataGridCell is not editable. Editing ability must be added by the Silverlight developer (or use a third party complex control). The only thing that can possibly be edited are the controls placed into cell.

The IsEnabled property is inherited from the base class System.Windows.Controls.Control. It only returns false when the control has been disabled, like a disabled button or input text box. The DataGridCell does not override this property in order to do anything special with it. Test Studio simply returns the current value of this property, which, as you have discovered, is always true as long as you can interact with the data grid cell, such as being able to put it into edit mode. When the cell is disabled you probably won't be able to put it into edit mode.

Because a DataGridCell can contain anything, what is probably being put into "edit mode" is the UI element that was placed into the cell, such as a TextBox. What is probably happening in your Silverlight application, when F2 is pressed the TextBox is made visible and when Esc is pressed, the content of the TextBox is read and placed into a TextBlock and the TextBox is replaced with the TextBlock.

Since every implementation of an editable Data Grid can be different, we cannot offer a generic "IsEditing" type of property. If your Silverlight developers do add a custom "IsEditing" property to your data grid cell we can read the value of that property using code like this:

// Get the current value of IsEditing property from the cell
bool isEditing = (bool)myDataGridCell.GetProperty(new AutomationProperty("IsEditing", typeof(bool)));
// Verify we are in edit mode
Assert.IsTrue(isEditing);

Greetings,
Cody
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Rahul
Top achievements
Rank 1
Answers by
Cody
Telerik team
Share this question
or