ListView事件属性 [英] ListView Event Properties

查看:97
本文介绍了ListView事件属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道为什么 WinJS.UI.ListView 没有"事件属性" (使用  WinJS.Utilities.createEventProperties 创建的)用于其事件( iteminvoked 等)。有没有理由呢?

I was wondering why WinJS.UI.ListView does not have "event properties" (those created using WinJS.Utilities.createEventProperties) for its events (iteminvoked etc). Is there a reason for that?

这对我来说是一个问题,因为我正在尝试使用
将函数绑定到 iteminvoked   data-win-bind 属性[1]。它适用于具有事件属性的自定义控件,但不适用于ListView。我可以通过手动将事件属性添加到有问题的ListView [2]来使其工作,但这感觉不对。

It is a problem for me because I'm trying to bind a function to iteminvoked using the data-win-bind attribute [1]. It works fine with my custom controls that have event properties, but it does not with ListView. I can make it work by manually adding the event properties to the ListView in question [2], but that does not feel right.

[ 1](请参阅此主题  ;如果你想知道为什么我没有使用  data-win-options

[1] (See this thread if you're wondering why I'm not using data-win-options)

[2] 像这样: Object。 defineProperties(listView.winControl,WinJS.Utilities.createEventProperties('iteminvoked'))

[2] like this: Object.defineProperties(listView.winControl, WinJS.Utilities.createEventProperties('iteminvoked'))

推荐答案

嗨G,

您可以追踪以查看失败的原因。

You can trace in to see why this is failing.

在Base.js的第392行放置一个断点,调试 你应该能够看到发生了什么。 通过检查,它看起来应该可以正常使用!

Put a Breakpoint on Line 392 of Base.js, debug and you should be able to see what is going on.  By inspection it looks like this should work fine for you!

意识到这是创建一个可以混入ListView的对象。 但是,在您的情况下分配事件监听器可能更容易!

Realize this is creating an object that you would mix-in to your ListView.  It might be easier just to assign the event listener in your case however!

-Jeff


这篇关于ListView事件属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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