kornerr / TestApp

Xamarin test app to depict list view update
8 stars 1 forks source link

RecycleElement doesn't work #1

Closed rraallvv closed 6 years ago

rraallvv commented 6 years ago

Using RecycleElement for MainPage.xml crashes the application:

[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] Xamarin.Forms.Xaml.XamlParseException: Position 11:14. Type   ListViewCachingStrategy not found in xmlns http://xamarin.com/schemas/2014/forms

Use CustomObservableCollection in my own application seems to work at first, but then if I enable RecycleElement items are not updated, although the app doesn't crash.

Disabling RecycleElement is a no-no for my app, since it scrolls too show if the list view has to allocate new cells.

Any idea what could be the problem?

Also CustomObservableCollection is not needed if one uses something like:

MyViewModel ViewModel { get => ((MyViewModel)BindingContext); }
//...
var index = ViewModel.Items.IndexOf(item);
ViewModel.Items[index] = null; // <-- this might not be necessary at all
ViewModel.Items[index] = word;
kornerr commented 6 years ago

Actually, I've dropped playing with Xamarin after some time because it crashed too often for me. And workarounds were too ugly at the time.

I don't have any Xamarin installation here, so can't check if Xamarin changed anything again.

Also, since my Xamarin attempts and MVVM approach, I found out Coordinators (another greater pattern) to fit better into my applications. So you may look into Coordinators instead of MVVM.

rraallvv commented 6 years ago

@kornerr, the more I think about using the Android and iOS SKDs, Java, Obj-C or Swift, separately for each platform, the more I settle down for Xamarin. The other option I can think of that could deliver is Flutter, but I'd prefer C# over Dart, besides, my favorite game engine also supports C#.

I haven't had any major problem with Xamarin yet, maybe I need to have a couple of application out there in the wild to see how it does.

I'll take a look into Coordinators, thanks for suggesting it, it's very much appreciated.

kornerr commented 6 years ago

Personally, I'm thinking about using C++ to share application logic between Android and iOS platforms.

So far C++ for cross-platform development proved to be the only stable solution for me

However, that's just an idea that I have in my long TODO list.

rraallvv commented 6 years ago

I totally agree, if C++ could be JIT-compiled as easily as C#, I would pick C++, since I really don't use that much the dynamic features in C#, but would love to have the speed and granular memory management of C++. The closest I've got to a satisfying solution, at least for me, is using Cling, or the Unreal Engine. I've used the former a couple of times as a REPL interface, and I recall trying to find a way to use it as a library to JIT-compile C++ but didn't have luck. The later though, has a very mature JIT-compilation mechanism built-in for C++, the problem is that the editor is CPU intensive, and it's not FOSS. In my previous post when I talked about my favorite game engine, I was talking about Godot, which will be releasing a stable version with C# scripting support, and they seem to have the fastest growing community, also one can program using C++ on Godot, but I haven't tried that yet, since it seems more suitable for editor extensions than for rapid development cycles. For game developing using C++, however, I tend to use Cocos2d-x which is very close to the metal, although I find myself using more and more Godot since mobile devices are very powerful these days for the C# VM to run smoothly.

kornerr commented 6 years ago

@rraallvv thanks for your input :)