![xamTilesControl Allow End Users to Close Tiles 01.png](images/xamTilesControl_Allow_End_Users_to_Close_Tiles_01.png)
You can allow your end users to close tiles by setting the TileCloseAction property exposed by xamTileManager or the CloseAction property exposed by a XamTile object. The CloseAction property of a XamTile object will override the TileCloseAction property of the xamTileManager. If you set the TileCloseAction property or CloseAction property to RemoveItem, xamTileManager will attempt to remove the item from its Items collection (unbound scenario) or the underlying data source (data-bound scenario). If the collection does not support removal, xamTileManager will hide the tile instead.
If you want to allow your end users to re-open closed tiles, you must provide a way to do it. For example code on re-opening closed tiles look at the "Tile Closing Actions" sample in the xamTileManager samples.
Finally, each XamTile object also exposes a CloseButtonVisibility property that you can set to hide the close button. However, setting the CloseAction property will automatically toggle the close button’s visibility.
The following example code demonstrates how to allow end users to close tiles.
In XAML:
<ig:XamTileManager Name="xamTileManager1" TileCloseAction="CollapseTile"> <ig:XamTile Header="Tile 1" /> <ig:XamTile Header="Tile 2" /> <ig:XamTile Header="Tile 3" CloseAction="DoNothing" /> </ig:XamTileManager>
In Visual Basic:
Imports Infragistics.Controls.Layouts ... Me.xamTileManager1.TileCloseAction = TileCloseAction.CollapseTile Dim nonClosableTile As Tile = _ xamTilesControl1.TileFromItem(xamTilesControl1.Items(2)) If nonClosableTile IsNot Nothing Then nonClosableTile.CloseAction = TileCloseAction.DoNothing End If ...
In C#:
using Infragistics.Controls.Layouts; ... this.xamTileManager1.TileCloseAction = TileCloseAction.CollapseTile; XamTile nonClosableTile = this.xamTilesControl1.TileFromItem(xamTilesControl1.Items[2]); if (nonClosableTile != null) { nonClosableTile.CloseAction = TileCloseAction.DoNothing; } ...