android - 选择项目后,PartialTextChanged 停止在 MvxAutoCompleteTextView 上触发

标签 android mvvmcross autocompletetextview

我在 Xamarin Android AutoCompleteTextView 周围使用 MVVMCross 的包装器。

我使用 PartialTextChanged changed 事件来表示我需要从 View 调用 ViewModel 以获得更多建议。

在用户从列表中选择一个项目之前,它工作正常。在那之后,对文本的任何更改都不会触发 PartialTextChanged 事件。就好像一旦做出选择就关闭了过滤。

AutoCompleteTextView 上有一个 SetText 方法似乎可以打开/关闭过滤,但我不确定使用它的最佳方法。

TextChangedEvent 仍然会像 AfterTextChanged 一样在控件上触发,只是不会触发 PartialTextChanged,它是驱动更新的原因。

我已经通过 MVVMCross 源代码进行了调试,但看不到解决方案。有什么想法吗?

我在哪里可以浏览它们 mondroid\xamarin android 代码?

谢谢

最佳答案

附加 MVVMCross 源代码并调试所有事件后,我发现在某些情况下,在更改 PartialText 属性后我没有更新 ItemsSource

FilteringAdapter 使用 ManualResetEvent 围绕对 PartialText 的更改,并且仅由 NotifyDataSetChanged 方法发出信号\设置。

在找到这个之后我还发现@slodge 在这个答案中也提到了这个,AutoComplete MVVM and Java Castings without using Java.Lang.Object on ViewModel .直到现在我都没有受到限制。

Note that because of the Android threading model it is essential that every change in PartialText is met by an eventual signalled change in ItemsSource - and this should be a single change in object collection rather than lots of small changes.

谢谢

关于android - 选择项目后,PartialTextChanged 停止在 MvxAutoCompleteTextView 上触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26543931/

相关文章:

java - Jackson 映射到 POJO 无法反序列化实例实例

android - AutoCompleteTextView 与 Google Places 在 ListView 中显示,就像 Uber

android - AutoCompleteTextView onSubmit 事件

android - AutoCompleteTextView 设置错误

android - 用于为 Android 应用程序生成促销代码的 ID

java - 尝试从 TextView 获取值并将其发送到 firebase 引用,但应用程序崩溃了

android - 结合 layout_weight 和 maxHeight?

c# - 如何使用 mvvcross/monodroid 在位图中插入文本?

android - 在 MvvmCross 3.5.1 中实现 fragment 的正确方法是什么

mvvm - UWP MvvmCross Bootstrap类不起作用