This control is WPF Specific, for more information refer to the WPF Specific topic
The xamTilesControl™ allows your end users to move tiles, resize tiles, and change the state of tiles at run time. Your end users may expect you to save and load their changes between sessions so they do not have to reconfigure the xamTilesControl every time they restart your application. Fortunately, the xamTilesControl exposes a SaveLayout and a LoadLayout method that can help you achieve this scenario.
For example code on saving and loading layouts, install the NetAdvantage WPF feature browser. In the feature browser, you can search for "Saving and Loading Layouts" or you can expand the xamTilesControl node, then expand the "Layout and Behavior" node and then select the "Saving and Loading Layouts" sample.
In order to save a tile's state information in a layout, you must name the tile or set its SerializationId property to a unique string value. If you set both the Name and the SerializationId property, the SerializationId property takes precedence. The xamTilesControl offers four different ways to set a tile's serialization ID.
- You can set each individual Tile object's SerializationId property. You can use this approach when you manually add tiles to xamTilesControl's Items collection.
- You can set the attached SerializationId property exposed by xamTilesControl. You can use this approach when you manually add items derived from the DependencyObject class to xamTilesControl's Items collection.
- You can set xamTilesControl's SerializationIdPath property to the name of a property exposed by your data items. You can use this approach when you bind xamTilesControl to data to create your tiles.
- You can handle the SavingItemMapping event and set the SavingItemMappingEventArgs object's SerializationId property. If you handle the SavingItemMapping event, you must also handle the LoadingItemMapping event to map the serialization ID to a specific item.
If you name a tile or supply a serialization ID but you do not want to save the tile, you can set its SaveInLayout property to False.
When you load a layout, xamTilesControl will automatically match the tile information found in the saved layout to an existing Tile object in its current layout. Then, it will raise the LoadingItemMapping event for each item in the saved layout. Handling this event gives you a chance to find out if the tile or item already exists in the current layout. If the item doesn't exist, you must create an appropriate item, set the LoadingItemMappingEventArgs object's Item property and add the item to xamTilesControl's Items collection (unbound scenario) or to your data source (data-bound scenario). If you do not supply an item in this event, xamTilesControl will skip the item.
The xamTilesControl will not remove tiles or items when you load a layout. If a tile or item exists in xamTilesControl's current layout but it does not exist in the saved layout, it will remain in the current layout.