We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Is it possible to identify a TileViewItem's Relative Position?

 I have a TileView control with several child TileViewItems.  These are set out in a 4 by 4 display .

I can use the DragCompleted event handler to know when the user has dragged and dropped an individual tileviewitem.

Is there any way of knowing the relative position of that item in the parent tileview once it's been dropped ?  - perhaps by its row and column location as in a grid?  Or any other way**?

A bit more background:  16 tiles are distributed randomly within the 4 by 4 tileview.   The user has to drag  the 16 tiles so that they end up with four sets of four tiles based on certain criteria.

So I'm not only trying to work out how to know where each tile lands as the user moves them, but also to know some property of its siblings in the row in which it is dropped .   I can see that maybe the Content or Tag property will do for this.   Basically a check carried out each time a tileviewitem is dropped to see if it's a match with the other 3 items in the row it's dropped into.

So it's knowing in which row a tile lands and which 3 tiles are its siblings in that row that has me stumped.  Can this information be accessed?  Any help appreciated.

-------------



** I have wondered if the collection of 16 child items in the tileview contol itself could be used - i.e. compare each of the TileViewControl.Items(0) (1) (2) and (3), 4 to 7, etc  - , but I can't imagine that physically dragging and dropping a tile is going to change its position in that collection, is it?




3 Replies

VR Venkateshwaran Ramdoss Syncfusion Team March 3, 2016 11:29 AM UTC

Hi Ged,

In our current implementation of TileViewControl, we maintain the Drag and Drop items and its position internally. So we were unable to keep track of the items in TileViewControl. Can you explain your scenario clearly it would help us to provide an appropriate solution.

Regards,
Venkateshwaran V.R.


GM Ged Mead March 3, 2016 02:45 PM UTC

Hi,

To help you visualize what I'm trying to do, imagine that you have a TileViewControl that contains 16 TileViewItems.  The layout of the Control is such that the 16 Items are displayed in 4 rows and 4 columns.

  For example's sake let's say that the content of four of the TileViewItems contain names of a kind of dog, four items are kinds of cat, four are kinds of fish and four are kinds of bird.  The order of the Items are scrambled so that the position of the tiles containing the different kinds of animal within the control is entirely random.  

The user's task will be to drag and drop those 16 tiles so that the completed display will contain one row of 4 tiles that are all dogs, another that are all cats, another that are all birds and one that are all fish.   (This isn't the actual implementation, but is logically the same and it's an easy to visualize explanation, I hope)

 So what I need to check each time the DragCompleted event fires is:
    Does the type of content of this item (eg, Dog, Cat, etc) match all the other three of the items in the row into which the item has just been dropped?

That's why I was asking about relative positions, so that I can compare the "types" - Dog, Cat, etc

You'll see from the explanation above that it isn't strictly necessary for me to know which row the tile is dropped into if there is some other way of checking whether the first four, second four, etc tiles match.  That's to say if the first four tiles inside the TileViewControl are of type Dog then that's what I need to know  - assuming of course that those first four tiles are guaranteed to be the first four tiles visible from the top left of the TileViewControl moving horizontally.

If the TileViewControl can't reveal this information then I can use a different control.  I just thought it's drag and drop functionality was so good that it was worth trying.

Any suggestions you have would be helpful.

  


VR Venkateshwaran Ramdoss Syncfusion Team March 8, 2016 11:31 AM UTC

Hi Ged,

Thanks for your explanation.

We can create a sample for your requirement by using the property "CurrentItemsOrder". This property holds the collection of TileViewItems current position. On using this property we can find the nearer items and the groups it belongs to.

While creating a sample, we found an issue with this property. We have logged defect report for this. We could see that you have created an incident for the same query. Please follow up that incident for further updates.

Regards,
Venkateshwaran V.R.

Loader.
Live Chat Icon For mobile
Up arrow icon