【问题标题】:ListView Grid Item Holding not workingListView Grid Item Hold 不起作用
【发布时间】:2015-08-01 00:45:11
【问题描述】:

我正在使用具有多个 DataTemplate 的 ListView。我正在尝试检测用户何时单击项目以显示 Flyout。 GridItem_Holding 永远不会被调用。

XAML:

    <DataTemplate x:Key="myKey1">
        <Grid Holding="GridItem_Holding">
        ...
        </Grid>
    </DataTemplate>
    <DataTemplate x:Key="myKey2">
        <Grid Holding="GridItem_Holding">
        ...
        </Grid>
    </DataTemplate>

后面的代码:

private void GridItem_Holding(object sender, HoldingRoutedEventArgs e)
{

}

【问题讨论】:

  • Holding 事件(?)从何而来?

标签: c# windows xaml listview windows-store-apps


【解决方案1】:

这样试试

<Grid x:Name="GridListItem" Holding="Grid_Holding">

【讨论】:

  • 它的作用是什么?介意解释一下吗?
【解决方案2】:

您还记得 Grid 或 children 上的 IsHoldingEnabled 吗?除非设置为 true,否则不会触发保持事件。

【讨论】:

  • 我在没有子节点的网格上设置了 IsHoldingEnabled,但什么也没发生。我搬到了 Tapped,一切正常
  • 我相信 ListView 和 Grid 的 IsHoldingEnabled 默认值已经是 true,除非您将其设置为 false
猜你喜欢
  • 2020-08-06
  • 2016-05-04
  • 1970-01-01
  • 1970-01-01
  • 2014-10-25
  • 1970-01-01
  • 1970-01-01
  • 2015-06-15
  • 1970-01-01
相关资源
最近更新 更多