protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Details); // Retrieve navigation parameter and set as current "DataContext" Vm = GlobalNavigation.GetAndRemoveParameter <FlowerViewModel>(Intent); var headerView = LayoutInflater.Inflate(Resource.Layout.CommentsListHeaderView, null); _nameText = headerView.FindViewById <TextView>(Resource.Id.NameText); _bindings.Add( this.SetBinding( () => Vm.Model.Name, () => _nameText.Text)); _bindings.Add( this.SetBinding( () => Vm.Model.Name, () => EditNameText.Text, BindingMode.TwoWay)); headerView.FindViewById <TextView>(Resource.Id.DescriptionText).Text = Vm.Model.Description; CommentsList.AddHeaderView(headerView); CommentsList.Adapter = Vm.Model.Comments.GetAdapter(GetCommentTemplate); ImageDownloader.AssignImageAsync(FlowerImageView, Vm.Model.Image, this); AddCommentButton.SetCommand(Vm.AddCommentCommand); EditNameButton.Click += EditNameButtonClick; SaveButton.SetCommand(Vm.SaveFlowerCommand); // Subscribing to events to avoid linker issues in release mode --------------------------------- // This "fools" the linker into believing that the events are used. // In fact we don't even subscribe to them. // See https://developer.xamarin.com/guides/android/advanced_topics/linking/ if (_falseFlag) { AddCommentButton.Click += (s, e) => { }; SaveButton.Click += (s, e) => { }; } }
private void RegisterCommands() { // bind the default commands to the buttons zoomInButton.SetCommand(Commands.IncreaseZoom, graphControl); zoomOutButton.SetCommand(Commands.DecreaseZoom, graphControl); zoom100Button.SetCommand(Commands.Zoom, 1, graphControl); fitContentButton.SetCommand(Commands.FitContent, graphControl); undoButton.SetCommand(Commands.Undo, graphControl); redoButton.SetCommand(Commands.Redo, graphControl); GroupSelectionButton.SetCommand(Commands.GroupSelection, graphControl); UngroupSelectionButton.SetCommand(Commands.UngroupSelection, graphControl); CutButton.SetCommand(Commands.Cut, graphControl); copyButton.SetCommand(Commands.Copy, graphControl); PasteButton.SetCommand(Commands.Paste, graphControl); openButton.SetCommand(Commands.Open, graphControl); SaveButton.SetCommand(Commands.SaveAs, graphControl); DeleteButton.SetCommand(Commands.Delete, graphControl); }