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

TileGroup detection

2 Answers 61 Views
TileList
This is a migrated thread and some comments may be shown as answers.
Jeroen
Top achievements
Rank 1
Jeroen asked on 12 Mar 2018, 04:13 PM
Is there a way to detect to which TileGroup the Tile has moved to?

2 Answers, 1 is accepted

Sort by
0
Jeroen
Top achievements
Rank 1
answered on 12 Mar 2018, 06:37 PM

In the mean time I have found an option that does the trick: Tile1.Group.ToString
However this doesn't work 100%. For example:

Private Sub Tile1_Drop(sender As Object, e As DragEventArgs) Handles Tile1.Drop
Debug.Print(Tile1.Group.ToString)
End Sub

does not consistently give me the TileGroup name it belongs to when dragging and dropping it into a different TileGroup, it does simply not give me anything or it gives me the name of the TileGroup.

I have tried other options but not consistently getting the TileGroup name is pretty consistent.

0
Dilyan Traykov
Telerik team
answered on 15 Mar 2018, 11:23 AM
Hello Jeroen,

I'm posting the answer from the support ticket you opened here as well so that it's beneficial to the community.

You can achieve the desired behavior using Telerik's DragDropManager and handling the DragInitialize and DragDropCompleted events.

Public Sub New()
    InitializeComponent()
    Me.RadTileList.ItemsSource = EmployeeService.GetEmployees()
    DragDropManager.AddDragInitializeHandler(Me.RadTileList, New DragInitializeEventHandler(AddressOf OnDragInitialized))
    DragDropManager.AddDragDropCompletedHandler(Me.RadTileList, New Telerik.Windows.DragDrop.DragDropCompletedEventHandler(AddressOf OnDropCompleted))
End Sub
 
Private Sub OnDropCompleted(ByVal sender As Object, ByVal e As DragDropCompletedEventArgs)
    Dim tile = TryCast(e.OriginalSource, Tile)
    Debug.WriteLine("Dragged to: " + tile.Group.Header.ToString())
End Sub
 
Private Sub OnDragInitialized(ByVal sender As Object, ByVal e As DragInitializeEventArgs)
    Dim tile = TryCast(e.OriginalSource, Tile)
    Debug.WriteLine("Dragged from: " + tile.Group.Header.ToString())
End Sub

I've also attached a small sample project as a demonstration.

I hope this is helpful.

Regards,
Dilyan Traykov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
TileList
Asked by
Jeroen
Top achievements
Rank 1
Answers by
Jeroen
Top achievements
Rank 1
Dilyan Traykov
Telerik team
Share this question
or