コード例 #1
0
        public TestPage()
        {
            InitializeComponent();

            this.BindingContext = ViewModel = new ViewModels.TestViewModel();

            //for (int c = 0; c < 3; c++)
            //{
            //    TestCtrlView ctrl = new TestCtrlView();
            //    ctrl.ButtonClicked += (sender, e) => { lblCounter.Text = ctrl.AsuntoID.ToString(); };
            //    this.slContent.Children.Add(ctrl);
            //}

            TestCtrlView ctrl = new TestCtrlView();

            ctrl.ButtonClicked += (sender, e) =>
            {
                lblCounter.Text          = ctrl.AsuntoID.ToString();
                this.CtrlPopup.ShowPopup = false;
            };

            CtrlPopup = new PopupView("Asuntos", ctrl)
            {
                ShowPopup = false
            };
            CtrlPopup.ButtonCloseClicked += (sender, e) => { lblCounter.Text = "Se pulso el b oton cerrar"; };
            var al = ((AbsoluteLayout)this.Content);

            al.Children.Add(CtrlPopup);
        }
コード例 #2
0
        public Type NextViewModelType(ViewModels.TestViewModel currentViewModel)
        {
            var index     = All.IndexOf(currentViewModel.GetType());
            var nextIndex = index + 1;

            if (nextIndex < All.Count)
            {
                return(All[nextIndex]);
            }

            return(null);
        }
コード例 #3
0
    /// <summary>
    /// Updates viewmodel to reflect the navigation that just occurred
    /// either via Bxf or via the browser navigation buttons or address bar.
    /// </summary>
    /// <param name="sender">Sender</param>
    /// <param name="e">Event args</param>
    public void Navigated(object sender, Bxf.Xaml.ExecuteEventArgs e)
    {
      var args = (NavigationEventArgs)e.TriggerParameter;
      if (args != null && args.Content != null)
      {
        var viewName = args.Uri.OriginalString;
        if (string.IsNullOrEmpty(viewName))
          viewName = "/MainPage.xaml";
        string queryString = null;
        var param = viewName.IndexOf("?");
        if (param > 0)
        {
          queryString = viewName.Substring(param + 1);
          viewName = viewName.Substring(0, param);
        }

        object viewmodel = null;
        // setup viewmodel for pages
        if (viewName.Contains("/TestPage.xaml"))
          viewmodel = new ViewModels.TestViewModel(queryString);
        ((Control)args.Content).DataContext = viewmodel;
      }
    }