English 中文(简体)
AutoComplete MVVM and Java Castings without using Java.Lang. 反对观点
原标题:AutoComplete MVVM and Java Castings without using Java.Lang.Object on ViewModel

i ve a problem with castings. First i will give an example how to do a custom Adapter for AutoComplete without MVVM in Monodroid: https://github.com/BitStab/Monodroid-Custom-Auto-Complete/blob/master/MonoAndroidApplication1/CustomerAdapter.cs

现在,我将在MVVERCross尝试这样做,但是要这样做,就必须将我的观点扩展到 Java。 Lang. 反对。 这将破坏其可携带性。 现在,Im搜身工作,不需要帮助。

我开始在微粒动物体内进行一些新课程,因为你可以在这里看到:rel=“nofollow”https://github.com/BitStab/MvmCross/tree/master/Cirrious/Cirrious/Cirrious.vMvmMvmross/roids。

I m trying to make it as generic as possible, but i need a method to cast from my personal C# object to Java.Lang.Object. Is there a method to do this without extending my ViewModel? If someone has another idea, i d be happy to get the inspiration!

得到帮助!

最佳回答

如果你想要有可携带的代码,那么你当然不想 Java,在你眼镜附近的任何地方any。

我恐怕我不会真正遵循客户Adapter榜样法——你的过滤和出版方法看不出。 此外,在我发现的 Java样本大多数之后,我有一些问题——从我所看到的,我不认为“自动答辩状”的可怕模式是理想的——它使read太久(IMHO)。

然而,在谷歌图书目录样本中出现一些黑客之后,我制作了一个样本——见录像:

“Two”/<img

This example works using a new alpha databinding Autocomplete class and adaptor within the MvvmCross framework. It may be that these classes never actually make the cut to be full time framework members - in which case they can live in some external library instead.

基本功能使用对3种新特性具有约束力的数据:

  • PartialText - which is a partial text string - sent from the View to the ViewModel
  • ItemsSource - which is the set of current items available for the supplied PartialText - sent from the ViewModel to the View
  • SelectedObject - which is the current selected item - sent from the View to the ViewModel

你可以在具有约束力的xml中看到:

<Mvx.MvxBindableAutoCompleteTextView
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  local:MvxItemTemplate="@layout/listitem_book"
  local:MvxBind="{ Text :{ Path : EnteredText , Mode : TwoWay },
   ItemsSource :{ Path : AutoCompleteSuggestions },
   PartialText :{ Path : CurrentTextHint },
   SelectedObject :{ Path : CurrentBook }}"
    />

请注意,由于 Android形模式,必须使部分提款的每一改动都通过最终信号改变项目Source来实现,而这应当是单项改动,而不是小改动。

这一初步样本的代码如下::https://github.com/slodge/MvmCross/tree/master/Sample%20SimpleDialDogal-Btive/SimpleBelle/DroidAComplet

请注意,这一样本使用的是“单纯的约束力”,而不是整个Mvx框架,因此,在《观点》中,对担忧的程度稍有增加。

具有约束力的观点及其适应者并非简单易行的法典――约束性守则在性质上是相当抽象的,但可以发现:


如果你在从长远来看做任何与网络连接的,我相信,最好采用一种新的自动清点观点,而不是将所建的星号用于今天!

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签