Show Dialog Fragment in Fragment

416 views Asked by At

How show MvxDialogFragment in MvxFragment. Can not use FragmentMaganer and other solution.

No Work

public void ShowFragmentLatestInvoices()
    {

        var transaction = FragmentManager.BeginTransaction();
        var Manager = FragmentManager.BeginTransaction ();
        LatestInvoicesFragment LatestInvoicesFragment = new LatestInvoicesFragment();
        LatestInvoicesFragment.DataContext = ViewModel.InvoiceVM;
        LatestInvoicesFragment.Show(SupportFragmentManager, "LatestInvoices_fragment");


        OnAttachFragment (LatestInvoices);
    }
2

There are 2 answers

0
Ibrahim Sušić On BEST ANSWER

Create private MvxFragmentActivity myContext;

add myContext = (MvxFragmentActivity)this.Activity;

and replace SupportFragmentManager with myContext.SupportFragmentMannager

var FragmentTransactions = FragmentManager.BeginTransaction ();
            var transaction = FragmentManager.BeginTransaction();
            var Manager = FragmentManager.BeginTransaction ();
            LatestInvoicesFragment LatestInvoicesFragment = new LatestInvoicesFragment();
            LatestInvoicesFragment.Show(myContext.SupportFragmentManager, "LatestInvoices_fragment");
2
Alexander On

You can get to Activity from the fragment by getActivity(), so you can do getActivity().getSupportFragmentManager() from your fragment