views:

67

answers:

1

Hi, I am new in this field and am trying to do a drag and drop from scatterview to librarystack, and when drop is executed, an event should be triggered ( after an image is dropped in the librarystack, a message box will be shown). However, I can not find the way to do it..

Below is the code snippets

<Grid> <!-- Drop 1.jpg to librarystack-->  <s:ScatterView AllowDrop="True">
    <Image Source="C:\1.jpg"/>   </s:ScatterView> 

<!--Librarystack get the 1.jpg and trigger an event--> <s:LibraryStack x:Name="myLibraryStack" Drop="myLibraryStack_Drop" Margin="376,0,389,0" Background="Transparent" Height="162" VerticalAlignment="Top" AllowDrop="True">

         </s:LibraryStack>    </Grid>

and

public SurfaceWindow1()
        {
            InitializeComponent();
            SurfaceDragDrop.AddDropHandler(myLibraryStack, OnPreviewDrop); 
        }


 private void myLibraryStack_Drop(object sender, SelectionChangedEventArgs e)
        {
            MessageBox.Show("HALLO");
        }

Would appreciate for any guidance

A: 

Hey, I think that the LibraryStack has to be inside the Scatterview to receive the drop. But I'm not sure. I had the problem myself once and this solved it, if I remember correctly.