小编Jan*_*man的帖子

如果ListView不是"无"选择模式,则RightTapped不会在Metro ListViewItem上触发

该问题几乎与此处描述的相同:http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/542b827a-7c8e-4984-9158-9d8479b2d5b1但我对接受的答案不满意在那里,并觉得必须有一个更好的解决方案......

我试图在我的列表视图上实现一个'clasic'上下文菜单(不是通过AppBar,而是通过PopupMenu)并且工作正常,但是只有当我将列表视图设置为"无"SelectionMode时.

上面的链接正确地解释了如果ListView设置为"无"选择模式以外的ListViewItem'吞下'右侧轻敲事件.如何覆盖此行为,以便列表视图项被选中,列表视图仍然会触发我可以响应的RightTapped事件?

c# xaml windows-8 windows-runtime winrt-xaml

3
推荐指数
1
解决办法
3266
查看次数

ListView和AppBar合作.最简单的多选方案

与AppBar一起实现列表视图多选方案的SIMPLEST方法是什么?因此,当选择多个项目时(例如,通过鼠标右键单击),它的行为与Windows 8开始屏幕完全相同.

我想显示应用栏以及第一个选定的列表视图项,我想用第二个,第三个等保持打开,我希望通过任何应用栏按钮操作(执行上下文操作)或通过其他系统范围的应用栏关闭操作(例如,右键单击其他位置,这将意味着上下文操作被取消).

我目前的实施太复杂了.我相信我一定错过了一些东西 - 这种基本和常见的场景必须能够以标准化的方式实施.

脚手架代码准备如下.如果只有此代码使用了应用栏,则在右键单击第二个列表视图项之前隐藏,再需要右键单击列表视图(不可接受).如果与IsSticky结合使用,则根本无法选择第二个列表视图项.

<Page
    x:Class="ListViewAndAppBar.ExamplePage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:ListViewAndAppBar"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    DataContext="{Binding ExamplePageViewModel, Source={StaticResource Locator}}">

    <Grid Background="Gray">
        <ListView
            x:Name="ListView"
            ItemsSource="{Binding Persons}"
            SelectionMode="Multiple"
            SelectionChanged="ListView_SelectionChanged">
        </ListView>
    </Grid>

    <Page.BottomAppBar>
        <AppBar x:Name="BottomAppBar" Padding="10,0,10,0">
            <Button x:Name="BottomAppBarBack" Tag="Back" Style="{StaticResource BackAppBarButtonStyle}" HorizontalAlignment="Left" />
        </AppBar>
    </Page.BottomAppBar>
</Page>

private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    this.BottomAppBar.IsOpen = true;
    //this.BottomAppBar.IsSticky = true;
}
Run Code Online (Sandbox Code Playgroud)

c# xaml appbar windows-8 windows-store-apps

2
推荐指数
1
解决办法
4047
查看次数