Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1750
SelectedItem/SelectedValue
posted

Hello community members!

In my solution I am using the xamtilemanager to administrate certain files. To delete or copy an item of the tiles i would like to bind the current selected item to my viewModel. If an Item is selected I want to execute delete or copy commands.

Unfortunatley I have not found a SelectedItem/SelectedValue or ActiveItem Property as it could be found eg in the xamdatagrid. Browsing the forum resources i found the following thread http://es.infragistics.com/community/forums/t/96889.aspx which uses an EventSetter for the PreviewMouseLeftButtonUp Event. Is this the only way to find out which tile was selected?

Thank you for the information

 

Parents
  • 34810
    Offline posted

    Hello grubarec,

    Thank you for your post.

    Currently, the XamTileManager does not have any sort of SelectedItem/SelectedValue/ActiveItem functionality implemented on it. This can be implemented though, by extending the XamTileManager and adding a custom dependency property to keep track of the selected item and the XamTile that it corresponds to. Since this new property is a dependency property, you would be able to bind a data item in your view model to it.

    By handling the PreviewMouseLeftButtonUp or the MouseLeftButtonUp event on the XamTiles, you can toggle their selection and use their Content property to get the data item that they represent. Then, you can set this particular data item to the SelectedItem property or remove it from the SelectedItem property if you wish to deselect it. Then, if that item becomes the selected item, you can apply a styling to the tile that corresponds to it. You can obtain this tile by using the XamTileManager.TileFromItem property.

    From here, you can create a couple of ICommand derivations which you can use for your copy and delete commands. If you pass your custom XamTileManager to these commands as the CommandParameter, you can check this newly created SelectedItem property and add or remove this item from the collection that makes up the ItemsSource of your XamTileManager if you are using one.

    I have attached a sample project demonstrating a way that this could be achieved. I hope this helps you.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer
    Infragistics Inc.
    www.infragistics.com/support

    XamTileManagerSelection.zip
Reply Children