surface drop image scatterview to librarystack, trigger event
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 dropp开发者_StackOverflow社区ed 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
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.
精彩评论