如何在ListView中显示弹出/弹出按钮按下时的项目/ GridView控件在Windows Store应用 [英] How to show Popup/Flyout at clicked item in ListView/GridView in Windows Store App

查看:144
本文介绍了如何在ListView中显示弹出/弹出按钮按下时的项目/ GridView控件在Windows Store应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作在Windows Store应用,并想显示有关被点击的ListView在GridView中或某个项目的更多信息。这些信息应该在弹出或飞出来显示(HAST不要在C#中被definded,而不是在XAML)旁边单击项目。

I am working on a Windows Store App and would like to show some additional information about an Item that was clicked in ListView or GridView. This information should be shown in a Popup or Flyout (hast do be definded in C#, not in XAML) next to the clicked item.

问题是,该项目单击事件处理程序没有给出关于点击的可视项目,但只有有关数据项的信息。因此,我不知道在哪里显示在屏幕上飞出或弹出信息。

The Problem is, that the ItemClick event handler gives no information about the clicked visual item but only about the data item. Thus I have no information about where to show the Flyout or Popup on screen.

推荐答案

使用附飞出:

<DataTemplate x:Key="ListItemTemplate">
    <Grid RightTapped="ListRightTapped" Tapped="ListTapped" Background="Transparent">
        <Grid>
            ...
        </Grid>
        <FlyoutBase.AttachedFlyout>
            <Flyout Closed="listFlyout_Closed">
                <StackPanel>
                    ...
                </StackPanel>
            </Flyout>
        </FlyoutBase.AttachedFlyout>
    </Grid>
</DataTemplate>

而code:

private void ListRightTapped( object sender, RightTappedRoutedEventArgs e )
{
    FlyoutBase.ShowAttachedFlyout( sender as FrameworkElement );
}

这篇关于如何在ListView中显示弹出/弹出按钮按下时的项目/ GridView控件在Windows Store应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆