Articles in this section
Category / Section

How to restrict the state changing action in WPF TileViewItem?

1 min read

In TileViewLayout, it is possible to restrict the TileVewItem State customization by handling StateChanging event in TileViewItem.

 

StateChanging Event

 

This event will occur when TileViewItemState is modified.

 

For example

 

Here we have restricted the state change action for Tile3.

 

The following code demonstrates the same.

 

Code Example: [Xaml]

 

<syncfusion:TileViewControl  Name="Tileview" >
 
<syncfusion:TileViewItem Header="Tile1" TileViewItemState="Minimized"/>
 
<syncfusion:TileViewItem TileViewItemState="Minimized" Header="Tile2"/>
 
<syncfusion:TileViewItem TileViewItemState="Minimized" Header="Tile3"/>
 
<syncfusion:TileViewItem TileViewItemState="Minimized" Header="Tile4"/>
 
</syncfusion:TileViewControl>

 

Code Example: [C#]

 

//For restrict specific item state changing action
 
foreach (TileViewItem item in Tileview.Items)
{
 
item.StateChanging += new TileViewItem.TileViewCancelEventHandler(item_StateChanging);
 
}
 
void item_StateChanging(object sender, TileViewCancelEventArgs args)
{
 
//Restrict State changing action for Tile3
 
if((sender as TileViewItem).Header.ToString()=="Tile3")
 
args.Cancel = true;
 
}

 

Screenshot:

 

A screenshot of a computer

Figure 1: Tile1 is moved to maximized state

 

A screenshot of a computer

Descriptio

Figure 2: Tile3 State cannot be changed.

 

 

Sample:  TileViewSample

 

 

Conclusion

I hope you enjoyed learning about how to restrict the state changing action in WPF TileViewItem.

You can refer to our WPF TileView feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF TileView example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!


Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied