WP7如何为每个Listbox Selected项添加上下文菜单?

时间:2013-10-21 06:49:12

标签: windows-phone-7 contextmenu

****** **** UPDATE

我设法让它只在单击一个项目时出现但是在其中显示“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

0 个答案:

没有答案