This is a migrated thread and some comments may be shown as answers.

Accessing bound object on drop into tileview

1 Answer 51 Views
TileView
This is a migrated thread and some comments may be shown as answers.
Nabil Shuhaiber
Top achievements
Rank 1
Nabil Shuhaiber asked on 16 Aug 2010, 09:28 PM
I have a tileview bound to an observablecollection A. I have implemented drag drop from a listbox bound to another observablecollection B. When I drag and drop from B to A I want to be able to access the item in the panel at the position I am dropping into if one exists. The reason is I may need to swap that item with the new one I am dropping in and there are also cases where I want to validate whether the user is allowed to drop the item into that position. Is this possible?

Thanks
Regards,
Nabil

1 Answer, 1 is accepted

Sort by
0
Miroslav
Telerik team
answered on 17 Aug 2010, 08:01 AM
Hi Nabil Shuhaiber,

It should be possible to traverse the VisualTree and access the objects in it. Normally you can avoid doing this by using routed events.

In your case if you are registering for the DragDrop (or other) events, you can register on any of the parents of the ListBox, e.g. the TileView itself. Then you can distinguish the different event sources by using the e.Source, you sign up for the event like so:

tileView.AddHandler(RadDragAndDropManager.DragQyeryEvent, new EventHandler<...>(...));

Another option is to add a global handler that will be called whenever a routed even passes though an object of this type:

EventManager.RegisterClassHandler(typeof(ListBox), RadDragAndDropManager.DQEvent, new EventHandler<...>(...));

This can be registered in a static constructor and will be called every time the event is routed though a ListBox.

Kind regards,
Miroslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TileView
Asked by
Nabil Shuhaiber
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
Share this question
or