protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetupBindings(); Parameter = Nav.GetAndRemoveParameter <object>(Intent); ViewModel.OnNavigatedTo(Parameter, NavigationMode.New); if (_falseFlag) { _fakeButton.Click += (s, e) => { }; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.DealDetail); //get the deal from navigation params. var param = Nav.GetAndRemoveParameter <Deal>(Intent); //set the image Resources res = Android.App.Application.Context.Resources; int id = (int)typeof(Resource.Drawable).GetField(param.ImageUrl).GetValue(null); ImageView imageView = (ImageView)FindViewById(Resource.Id.photo); imageView.TransitionName = Intent.GetStringExtra(param.ImageUrl); var myImage = BitmapFactory.DecodeResource(res, id); imageView.SetImageBitmap(myImage); //intialize view model and set value. detailDealVM = ViewModelLocator.detailViewModel; detailDealVM.Title = param.mCaption; detailDealVM.Description = param.mDesc; detailDealVM.Favourite = param.mFav; detailDealVM.Price = param.mPrice; detailDealVM.Done = param.mDone; //Toggle the favourite button icon image. ToggleFavourite(detailDealVM.Favourite); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); toolbar.SetBackgroundColor(Color.ParseColor("#d50000")); SetActionBar(toolbar); toolbar.SetNavigationIcon(Resource.Mipmap.ic_arrow_back); //set the command property on navigation button. toolbar.SetCommand("NavigationOnClick", detailDealVM.GoBackCommand); //Set the command property on button. MFavourite.SetCommand("Click", detailDealVM.AddFavourite); //set the command for buy now. MBuyNow.SetCommand("Click", detailDealVM.ShowDoneCommand); //Bind the view with viewmodel data and notification. BindView(); }
public override void ViewDidLoad() { Vm = (FlowerViewModel)Nav.GetAndRemoveParameter(this); DescriptionText = new UILabel(new CGRect(0, 0, 300, 235)) { LineBreakMode = UILineBreakMode.WordWrap, Lines = 0 }; Scroll.Add(DescriptionText); FlowerImage.SetImage( new NSUrl(Vm.ImageUri.AbsoluteUri), UIImage.FromBundle("flower_256_magenta.png")); this.SetBinding( () => Vm.Model.Name) .WhenSourceChanges( () => { // iOS is quite primitive and requires layout recalculation when the content // of UI elements changes. This is a good place to do that. NameText.Text = Vm.Model.Name; NameText.SizeToFit(); NameText.Frame = new CGRect(140, 75, 170, NameText.Bounds.Height); }); this.SetBinding( () => Vm.Model.Description) .WhenSourceChanges( () => { DescriptionText.Text = Vm.Model.Description; DescriptionText.SizeToFit(); DescriptionText.Frame = new CGRect( 0, 0, Scroll.Bounds.Width - 20, DescriptionText.Bounds.Height); Scroll.ContentSize = new CGSize(Scroll.Bounds.Width - 20, DescriptionText.Bounds.Height + 20); Scroll.SetNeedsLayout(); }); SeeCommentsButton.TouchUpInside += (s, e) => { Nav.NavigateTo(AppDelegate.SeeCommentsPageKey, Vm); }; base.ViewDidLoad(); }
public override void ViewDidLoad() { Vm = (FlowerViewModel)Nav.GetAndRemoveParameter(this); SaveCommentButton = new UIBarButtonItem(UIBarButtonSystemItem.Save, null); NavigationItem.SetRightBarButtonItem(SaveCommentButton, false); _commentBinding = this.SetBinding(() => CommentText.Text); SaveCommentButton.SetCommand( Vm.SaveCommentCommand, _commentBinding); base.ViewDidLoad(); }
public override void ViewDidLoad() { Vm = (FlowerViewModel)Nav.GetAndRemoveParameter(this); _tableController = Vm.Model.Comments.GetController( CreateCommentCell, BindCommentCell); _tableController.TableView = CommentsTableView; AddCommentButton = new UIBarButtonItem(UIBarButtonSystemItem.Add, null); NavigationItem.SetRightBarButtonItem(AddCommentButton, false); AddCommentButton.SetCommand(Vm.AddCommentCommand); base.ViewDidLoad(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.DealDetail); var param = Nav.GetAndRemoveParameter <DetailItem>(Intent); Resources res = Android.App.Application.Context.Resources; int id = (int)typeof(Resource.Drawable).GetField(param.mDeal.ImageUrl).GetValue(null); ImageView imageView = (ImageView)FindViewById(Resource.Id.photo); imageView.TransitionName = Intent.GetStringExtra(MainActivity.EXTRA_DEAL); var myImage = BitmapFactory.DecodeResource(res, id); imageView.SetImageBitmap(myImage); Window.EnterTransition.AddListener(new DetailsTransitionAdapter(this)); }
public override void ViewDidAppear(bool animated) { Parameter = (object)Nav.GetAndRemoveParameter(this); ViewModel.OnNavigatedTo(Parameter, NavigationMode.New); base.ViewDidAppear(animated); }