DataGrid.GetGroupFromItem Method
Silverlight
Gets the row group that the specified item belongs to.
Namespace: System.Windows.Controls
Assembly: System.Windows.Controls.Data (in System.Windows.Controls.Data.dll)
Parameters
- item
- Type: System.Object
The item to find the group for.
- groupLevel
- Type: System.Int32
The group sub level that the item is in.
Return Value
Type: System.Windows.Data.CollectionViewGroupThe row group that the specified item belongs to.
You can use the GetGroupFromItem method to get the CollectionViewGroup that a specified item belongs to. The CollectionViewGroup can be passed to the ExpandRowGroup and CollapseRowGroup methods.
The following code example demonstrates how to get the CollectionViewGroup that the currently selected item belongs to.
[Visual Basic]
Dim cvg = dataGrid1.GetGroupFromItem(dataGrid1.SelectedItem, 0)
[C#]
CollectionViewGroup cvg = dataGrid1.GetGroupFromItem(dataGrid1.SelectedItem, 0);
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.