WinUI3 : how to know which uielement was dropped in UIElement.drop() event

Harshithraj1871 1,581 Reputation points
2022-12-28T07:53:16.833+00:00

Hi,

I was trying to perform a drag and drop operation. When i drop a textbox on a canvas i get drop event from canvas. there as a sender we can get a reference to the canvas instance[ the UIElement on which the drop happened ]. but how to know which element was dropped on canvas?

Thank you

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
823 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,857 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Harshithraj1871 1,581 Reputation points
    2023-01-05T05:45:55.38+00:00

    Hi,

    Found a solution that worked for me, we can use SetText to pass data with the data package between DragStarting and Drop events.

    Ref - https://stackoverflow.com/questions/74979473/winui3-how-to-know-which-uielement-was-dropped-in-uielement-drop-event/75008259#75008259

    Thank you


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.