protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); if (savedInstanceState == null) { //Se genera la instancia del fragment "inicial" Fragment first = FirstFragment.NewInstance(); //Se obtiene una referencia del "FragmentManager" FragmentManager manager = this.FragmentManager; //Se inicia una transacción con ayuda del "FragmentManager" FragmentTransaction transaction = manager.BeginTransaction(); //Se agrega el Fragment a la interfaz transaction.Add(Resource.Id.contenedor, first); //Se confirma la transacción ;P transaction.Commit(); } }
public override Fragment GetItem(int position) { switch (position) { case 1: return(SecondFragment.NewInstance()); case 2: return(ThirdFragment.NewInstance()); } return(FirstFragment.NewInstance()); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Frame); var firstFragment = new FirstFragment() { ViewModel = new FirstViewModel() }; this.NextFragment(Resource.Id.frame, firstFragment); }