Yes. We're doing this now by subclassing DataGrid and handling the PreparingCellForEdit event. Here is the code.
Imports
Csla.SilverlightPublic
Class EditableGridBase Inherits DataGrid Public Sub New() AddHandler CurrentCellChanged, AddressOf dg_CurrentCellChanged AddHandler PreparingCellForEdit, AddressOf dg_PreparingCellForEdit End Sub Private Sub dg_CurrentCellChanged(ByVal sender As Object, ByVal e As EventArgs)EnterEditMode()
End Sub Sub EnterEditMode() TryBeginEdit()
Catch ex As Exception End Try End Sub Private Sub dg_PreparingCellForEdit(ByVal sender As Object, ByVal e As DataGridPreparingCellForEditEventArgs) Dim txt As TextBox = Nothing If TypeOf e.Column Is ValidatedDataGridTextColumn Then Dim sp = TryCast(e.EditingElement, StackPanel)txt =
TryCast(sp.Children(0), TextBox) Dim p = TryCast(sp.Children(1), PropertyStatus)txt.Width = e.Column.ActualWidth - 2
p.Visibility = Windows.Visibility.Collapsed
ElseIf TypeOf e.Column Is DataGridCheckBoxColumn Then Dim ch = TryCast(e.EditingElement, CheckBox) If ch IsNot Nothing Thench.Focus()
ch.IsChecked =
Not ch.IsChecked.Value Return End If Elsetxt =
TryCast(e.EditingElement, TextBox) End If If txt IsNot Nothing Thentxt.SelectionLength = txt.Text.Length
txt.Focus()
End If End SubEnd
ClassCopyright (c) Marimer LLC