Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to use MvxFragment in MvvmCross?

$
0
0

I have created a MvxFragment as;

using MvvmCross.Droid.Views.Attributes;
using MvvmCross.Droid.Views.Fragments;

namespace FragmentMvvm.Droid.Fragments
{
    [MvxFragmentPresentation(typeof(MainViewModel), Resource.Id.fragment_container)]
    [Register("fragmentmvvm.droid.fragments.NormalFragment")]
    public class NormalFragment : MvxFragment<SubViewModel>
    {
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
        }

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            return inflater.Inflate(Resource.Layout.NormalFragment, container, false);
        }
    }
}

Most of the guide in the internet use MvxFragment instead of MvxFragmentPresentation. If I use MvxFragment, I get 'MvxFragment' is not an attribute class error. So, I used MvxFragmentPresentation. Is this the correct way? Is this something that changed in MvvmCross 5?

I also tried using this.BindingInflate() but I am not able to access BindingInflate. It appears that it does not exist. The fragment loads but data binding does not work inside a fragment. I am new to MvvmCross. What am I missing?

I am using latest version of MvvmCross(5.6.3).


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>