Category / Section
How to close the TileViewItem by using CodeBehind?
1 min read
You can directly close the TileViewItem by clicking close button at the Right corner of the TileViewItem. To close the TileViewItem in codebehind, you can use CloseTileViewItem method of the TileViewControl.
Refer to the following code examples.
XAML
<syncfusion:TileViewControl x:Name="tile"> <syncfusion:TileViewItem Header="Item 1" x:Name="tile1" /> <syncfusion:TileViewItem Header="Item 2"/> <syncfusion:TileViewItem Header="Item 3"/> <syncfusion:TileViewItem Header="Item 4"/> </syncfusion:TileViewControl> <Button Content="Click to close Item1" Click="Button_Click" VerticalAlignment="Bottom" />
C#
private void Button_Click(object sender, RoutedEventArgs e) { this.tile.CloseTileViewItem(this.tile1); }
The following screenshots display the TileViewItem with the CloseTileViewItem method.