数据绑定:不使用转换器 [英] Data binding: not working with converter
问题描述
大家好,
在我的应用程序中我有一个ListView使用数据绑定来显示项目。当我只使用一个简单的属性来绑定textContent属性时,一切都按预期工作。但是如果我添加转换器,则不会显示任何内容,因为我的转换器中有一个断点
,我知道它甚至没有被调用。
in my application I have a ListView using data binding to display items. When I use only a simple property to bind the textContent attribute, everything works as expected. But if I add the converter, nothing at all is displayed and since there's a breakpoint in my converter, I know that it doesn't even get invoked.
据我所知,这应该是指定转换器的正确方法:
As I understand, this should be the right way to specify the converter:
<h4 data-win-bind="textContent:className converters.classNameToString"></h4>
我很乐意提供任何提示。
I'd be glad for any hints.
推荐答案
更新:我对base.js进行了一些调试,发现在第7398行中,使用source,sourceProperties和看起来正确的转换函数创建了bindWorker。但是我在工作者回调函数(第7399行)中放置的任何断点都不会达到
,VisualStudio甚至会在重新启动调试器后删除断点。
Update: I did some debugging into base.js and found that in line 7398 a bindWorker is created with a source, sourceProperties and a convert function that looks correct. But any breakpoint I put inside the worker callback function (line 7399) is never reached and VisualStudio even removes the breakpoint after restarting the debugger.
[我尝试删除.suo来自我的解决方案目录的文件,但这对于消失的断点没有帮助]
[I tried deleting the .suo file from my solution directory but that doesn't help regarding the disappearing breakpoint]
这篇关于数据绑定:不使用转换器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!