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)
7 Replies
And modify the style accordingly
Assuming you use Avalonia
My apologies, just assumed you wanted to change style.
Didn't read the question.
Yes i am using Avalonia. but i don't understand what you mean by set a class. you mean oh okay. that's fine
this is how it looks now (for your better understanding)
Avalonia has classes, just like with web elements.
example
What exactly isn't working?
yes, and i need to select the grey rectangle class which the orange rectangle belonged to.
but when i try, the rawMaterial variable in the event handler image always gets null...
Did you set a breakpoint to see the values?
it's always null so i tried getting parent class without specifying the type. and it gets the border class which is the parent class right above it.
but it doesn't get the grey rectangle when i specify the type Or name of it