N=32 - ViewModels and MvxView on the iPad - N+1 days of MvvmCross

Stuart Lodge · 3K views · 2013 · 49:09

Open on YouTube

Software architecture & designSoftware practice, open source & careerstutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering or asking about MvvmCross custom views, runtime-created controls and bindings to ViewModel properties, as it is the canonical walkthrough from the framework's author.

Recommended by 2 people across 2 different months, 2013 to 2019.

What it is

Episode 32 of Stuart Lodge's 'N+1 days of MvvmCross' tutorial series, a 49-minute screencast on using ViewModels and MvxView on the iPad in Xamarin.iOS. It covers using more than one ViewModel per screen, data binding, and building custom views, with the custom view section starting around minute 20.

What people said

Recommends Mohib Sheth · 2013-07 · Stack Overflow · on “Does MvvmCross allow binding of ViewModel properties to controls created on the fly?”

Yes MvvmCross supports binding properties to controls created at runtime. You can watch this tutorial by the awesome Mr. Stuart in his N+1 series. [this video] Note: He has shown this many a times in the series but I remember this one on the top of my head right now.

Recommends Pat Long - Munkii Yebee · 2015-01 · Stack Overflow · on “Custom Controls in Xamarin iOS with MVVMCross and no XIB”

As Stuart said in his comment, N=32 - ViewModels and MvxView on the iPad - N+1 days of MvvmCross [LINK] is the MVVMCross tutorial you want. For those that are happy with the idea of ViewModels being more than just a ViewModel per screen and understand Binding the bit around Custom Views starts at minute 20 [this video]

Cites Patrick McCurley · 2013-10 · Stack Overflow · on “Weak referencing in MvvmCross with Action<T>”

As previously detailed in some MvvmCross videos ( [this video] ) I am trying to remove strong references from my viewmodel to my views. Having implemented WeakSubscribe() where PropertyChanged += has been used I have now come across some scenarios where I am using Action to allow the view to observe. I assume this will lead to potential memory leaks again, so attempting to erradicate. However - WeakReference works on the basis of hooking to an INotifyPropertyChanged source: [LINK] So should I be refactoring my code to ditch Action and to be firing via PropertyChanged to be able to inform the view via a weak reference? Here is some sample code just for reference - of the current strongly reference

Cites nihil · 2014-07 · Stack Overflow · on “Proper configuration change handling”

I'm writing a cross-platform app for iOS and Android using MvvmCross. The Android version makes use of nested Fragments. For example, the home view is a navigation drawer, its various navigation hub views are Fragments which may be split views containing other fragments, and on top of that, each view may show a dialog fragment as well. Additionally, not all ViewModels are shown via ShowViewModel(), some of them are used more like PropertyChanged event providers as demonstrated in the N=32 video [this video] . This is working fine until a configuration change takes place (typically, rotating the device). When the fragment views get recreated, their View Models aren't and are set to null. This is h

Cites Krzysztof Kaźmierczak · 2019-06 · Stack Overflow · on “Problem with binding to MvxView with Xamarin.iOS and MvvmCross”

I have a problem with implementing following scenario using Xamarin.iOS and MvvmCross (6.2.3.0). I have a view and in it's viewmodel I have a property which is a list of objects. I need to dynamically generate a label and a textfield for each of this list entry on my view. So I decided to implement a custom view for this. Here is what I tried so far: In my viewcontroller, in CreateView I simply add my custom UIView. I can see it's content on my view. In ViewDidLoad() I create bindings: private void CreateBindings() { var set = this.CreateBindingSet<MyController, MyViewModel>(); set.Bind(myCustomControl).For(x => x.DataContext).To(vm => vm.MyListOfObjects); set.Apply(); } MyCustomControl code