我开始为Microsoft Surface编程,我遇到了问题。
我正在使用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.
}
}
我想通过“ContactLeave =”MainScatterView_ContactLeave“获取项目的名称, 但我不知道怎么办。
你能帮我吗?
谢谢。
答案 0 :(得分:0)
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));
}
}