Hello,
we want to use XamTilesControl for a complex view where lots of controls change the state of a given "document" (a tile). To implement this we need a way to obtain the selected tile. We also need a graphical accentuation for the selected tile. As far as I can see this is possible with the XamDataCards control but it lacks the support for moving cards.
So we need the feature set of XamTilesControl with the possibility to have a selected tile. Is there any way to achieve this?
Thanks in advance
The XamTilesControl is a derived ItemsControl so it does not support selection. What you can do to mimic selection is to create an attached property for the Tiles or the xamTilesControl and use it: For example, you an create an attached property for the XamTilesControl and set it for the tile when you clck on it (PreviewMouseLeftButtonDown event). I have attached sample with a simple implementation of this suggestion.
I love this example and found it easy to implement. I do have one question. How can I make it such that only one may be selected? The other tiles don't update when another tile becomes the selectedTile.
I have updated the sample with more properties:
AllowMultipleSelection - which determines whether one or more tiles can be selected at a time
SelectedTile - returns the last selected tile. You can implement SelectedTiles similarly.
IsSelected - returns the selection state of the Tile
Hey,
Thanks for the additions.
When I scroll, sometimes, things get messed up. All tiles become unselected. When I break in OnSelectedTileChanged on reselecting something the e.OldValue is 'DisconnectedItem'.
Any ideas? I need the selection to be very persistent.
Thanks,
Cody