TileGroup detection

3 posts, 0 answers
  1. Jeroen
    Jeroen avatar
    3 posts
    Member since:
    Mar 2018

    Posted 12 Mar 2018 Link to this post

    Is there a way to detect to which TileGroup the Tile has moved to?
  2. Jeroen
    Jeroen avatar
    3 posts
    Member since:
    Mar 2018

    Posted 12 Mar 2018 Link to this post

    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.

  3. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    908 posts

    Posted 15 Mar 2018 Link to this post

    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.
Back to Top