C#C
C#•2y ago
smimashen

Avalonia: how to get the data of a control where the sender belongs to?

My program requires a drag-and-drop. when i move a 'part' rectangle into another 'raw material' rectangle, it's successfully added to where i dropped but i need to remove the moved part from its original location. but i am struggling to get the data of the raw material where the dragged part belonged to... i guess it's because part rectangle is not directly parented with the raw material rectangle but i have no idea how to solve this 😦

The data structure of Bound ItemsSource:
A list of RawMaterial ('ArrangedRawMaterials' in the code)
RawMaterial contains a list of Parts ('PartsInside' in the code)
Screenshot_2024-05-09_at_6.59.49_PM.png
Screenshot_2024-05-09_at_7.01.19_PM.png
Was this page helpful?