2011-03-05 19 views
0

我開始爲Microsoft Surface進行編程,並且遇到問題。在Scatterview中獲取ScatterviewItem的名稱並綁定

我使用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
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)); 
     } 
    } 
相關問題