******更新****
我设法让它只在单击一个项目时出现,但是对于它说“867”的地方,我如何将它绑定到目录中的所有文件名?
这是我的 XML
<ListBox toolkit:TiltEffect.IsTiltEnabled="True" x:Name="ListBox1" FontSize="42.667" FontFamily="Segoe WP SemiLight" IsSynchronizedWithCurrentItem="False">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel x:Name="sp">
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu>
<toolkit:MenuItem Header="Delete" Click="Delete_Click" Name="MenuItem1" />
<toolkit:MenuItem Header="Edit" Click="Edit_Click"/>
<toolkit:MenuItem Header="View" Click="View_Click"/>
<toolkit:MenuItem Header="Share.." Click="Share_Click"/>
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
<TextBlock Text="867" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
这是将文件加载到列表框中的内容:
Dim myIsolatedStorage As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()
myIsolatedStorage.CreateDirectory("myNote")
Dim directory As String = "./myNote/*.*"
Dim filenames As String() = myIsolatedStorage.GetFileNames(directory)
ListBox1.ItemsSource = filenames