protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.activity_user_detail); var toolbar = (Android.Support.V7.Widget.Toolbar)FindViewById (Resource.Id.detail_toolbar); SetSupportActionBar (toolbar); Android.Support.V7.App.ActionBar actionBar = SupportActionBar; // savedInstanceState is non-null when there is fragment state // saved from previous configurations of this activity // (e.g. when rotating the screen from portrait to landscape). // In this case, the fragment will automatically be re-added // to its container so we don't need to manually add it. // For more information, see the Fragments API guide at: // // http://developer.android.com/guide/components/fragments.html // if (savedInstanceState == null) { var fragment = new UserDetailFragment (); var fragmentTransaction = SupportFragmentManager.BeginTransaction (); fragmentTransaction.Add (Resource.Id.user_detail_container, fragment).Commit (); var a = ServiceLocator.Current.GetInstance<UsersViewModel> (); var b = a.SelectedUser; SupportActionBar.Title = "[Detail]"; } }
public void OnClick(View v) { if (mTwoPane) { ServiceLocator.Current.GetInstance<UsersViewModel> ().SelectUserCommand.Execute (_holder.mItem); UserDetailFragment fragment = new UserDetailFragment (); _fragmentManager.BeginTransaction().Replace (Resource.Id.user_detail_container, fragment).Commit (); } else { Context context = v.Context; ServiceLocator.Current.GetInstance<UsersViewModel> ().SelectUserCommand.Execute (_holder.mItem); Intent intent = new Intent (context, typeof(UserDetailActivity)); context.StartActivity (intent); } }