2

When we are disabling (IsEnabled="False") a DataGridCell it ceases to raise the Mouse Double Click event. We want to still be able to tap into the double click event to do something when the cell is double click (on both disabled and enabled states).

How do we do that?

Jon Erickson
  • 112,242
  • 44
  • 136
  • 174

1 Answers1

3

Disabling the DataGridCell will disable all Mouse and Keyboard Events for that Cell. If you still need to respond to Mouse/Keyboard events try setting the IsReadOnly Property.

From First Link:

Elements that are not enabled do not participate in hit testing or focus and therefore will not be sources of input events.

Mark Hall
  • 53,938
  • 9
  • 94
  • 111
  • I believe the `IsReadOnly` property on a `DataGridCell` is readonly itself. Now, the `IsReadOnly` property on a column can be set, but I don't know if that is what OP is asking for. – JChristian Aug 07 '12 at 16:12
  • @JChristian According to the documents it can be set. But it is the only option that I can see other than intercepting the double click at the window level and mapping the mouse location to the cell. – Mark Hall Aug 07 '12 at 16:40
  • According to [this MSDN article](http://msdn.microsoft.com/en-us/library/system.windows.controls.datagridcell.isreadonly.aspx), it is readonly. Also, doing a quick check in the IDE confirms this. Are you sure you aren't thinking of `IsReadOnly` on a column or grid? – JChristian Aug 07 '12 at 17:27
  • Strange, in the remarks section of the article it says, "_Set the IsReadOnly property to true to make an individual cell read-only_". I don't know how you would do that, though, since the property only has a setter and the dependency property is registered as readonly. I'm I missing something here? – JChristian Aug 07 '12 at 17:35