Version

Retrieve a Reference to a Tile

You can add tiles to xamTileManager™ by adding XamTile objects, UIElements and/or data items to its Items collection or by binding xamTileManager to data. Since the xamTileManager offers several different ways to create tiles, casting an item in the Items collection to an instance of a XamTile object may fail. Instead, you should use the TileFromItem method exposed by xamTileManager to retrieve a reference to a XamTile object based on an item in the Items collection or in your data source.

The following example code demonstrates how you can retrieve a reference to a XamTile object.

In XAML:

<ig:XamTileManager Name="xamTileManager1" HeaderPath="Tag">
    <TextBlock Tag="Tile 1" Text="Content Area" />
    <Button Tag="Tile 2" Content="Content Area" />
    <ig:XamTile Header="Tile 3" Content="Content Area" />
</ig:XamTileManager>

In Visual Basic:

Imports Infragistics.Controls.Layouts
...
Dim tile1 As XamTile = _
    Me.xamTileManager1.TileFromItem(Me.xamTileManager1.Items(0))
If tile1 IsNot Nothing Then
    tile1.CloseAction = TileCloseAction.CollapseTile
End If
...

In C#:

using Infragistics.Controls.Layouts;
...
XamTile tile1 =
    this.xamTileManager1.TileFromItem(this.xamTileManager1.Items[0]);
if (tile1 != null)
{
    tile1.CloseAction = TileCloseAction.CollapseTile;
}
...