The DependencyObject for which to find the parent cell.
Return Value
The parent cell of the child.
Example
All examples in this topic assume that the grid is bound to the Products table of the Northwind database, unless stated otherwise
The following example demonstrates how to use an unbound column to display a button that, when clicked, will display an editor through which the corresponding data item can be edited.The following code provides the implementation of the Button_Click event. The ProductsEditorWindow derives from Window and allows the data item to be edited. The code for the ProductsEditorWindow is not provided.The following code provides the implementation of the Button_Click event. The ProductsEditorWindow derives from Window and allows the data item to be edited. The code for the ProductsEditorWindow is not provided.
PrivateSub Button_Click( ByVal sender AsObject, ByVal e As RoutedEventArgs )
Dim cell As Cell = Cell.FindFromChild( TryCast( sender, DependencyObject ) )
Dim editor AsNew ProductsEditorWindow( TryCast( DataGridControl.GetParentDataGridControl( cell ).GetItemFromContainer( cell.ParentRow ), DataRowView ) )
editor.ShowDialog()
End Sub
privatevoid Button_Click( object sender, RoutedEventArgs e )
{
Cell cell = Cell.FindFromChild( sender as DependencyObject );
ProductsEditorWindow editor = new ProductsEditorWindow( DataGridControl.GetParentDataGridControl( cell ).GetItemFromContainer( cell.ParentRow ) as DataRowView );
editor.ShowDialog();
}
Requirements
Target Platforms: Windows 11, Windows, 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2