Welcome to Xceed DataGrid for Silverlight > Paths and Containers |
Every element in a grid, with the exception of items located in the fixed header or footer sections of a grid or group, can be represented by a datagrid path (see DataGridPath class), which provides a linear representation of the element's hierarchical location in a grid.
A datagrid path's DataPath property exposes, as a generic list, the elements that make up an element's path. Each element that is part of a data path, with the exception of groups, is represented by the actual object instance. Groups are represented by their value. For example, if a group is represented by its value (e.g., "Canada") and a data item is represented by the actual object instance (e.g., OrderDataItem), the resulting data path for a data item that is located in a "Canada" group would be {"Canada", OrderDataItem}.
The element that is represented by the datagrid path is always the last element in the path. To retrieve the path of the parent element, the ParentPath property can be consulted.
A data item's path can be retrieved through a grid's GetPathFromItem method while the path for any container can be retrieved using the GetPathFromContainer method.
Each data item in a grid has a corresponding container (see DataRow class) that can be retrieved through a grid's GetContainerFromItem method. Likewise, a container that is represented by a datagrid path (e.g., the default GroupHeaderControl) can be retrieved through the GetContainerFromPath method.
Only the data items that are visible in the viewport will have an associated container. |
GetPathFromItem method
GetContainerFromItem method