Get Name of ScatterviewItem in a Scatterview with binding
I started to program for Microsoft Surface and I have a problem.
I'm using scatterview
<s:ScatterView Name="MainScatterView" ContactLeave="MainScatterView_ContactLeave" ContactEnter="MainScatterView_ContactEnter">
<s:ScatterView.ItemTemplate>
<DataTemplate>
<Image Name="picture" Source="{Binding}"/>
</DataTemplate>
</s:ScatterView.ItemTemplate>
</s:ScatterView>
protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
try
{
MainScatterView.ItemsSource =
System.IO.Directory.GetFiles(@"C:\Surface_App_Dam\img\", "*.png");
}
catch (System.IO.DirectoryNotFoundException)
{
// Handle exception as needed.
}
}
I would like to get the name of item I've moved with "ContactLeave="MainScatterView_开发者_如何学编程ContactLeave", but I don't know how can I do that.
Could you help me please?
Thank you.
private void MainScatterView_PreviewContactUp(object sender, ContactEventArgs e)
{
if (e.GetPosition(this).X < 100 && (coordinates.Height - e.GetPosition(this).Y) < 100)
{
string file = e.OriginalSource.ToString();
UserNotifications.RequestNotification("Notification PreviewContactUp", file, TimeSpan.FromSeconds(2));
}
}
精彩评论