コード例 #1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            this.EnsureBindingContextIsSet(savedInstanceState);
            var ignored     = base.OnCreateView(inflater, container, savedInstanceState);
            var view        = this.BindingInflate(Resource.Layout.FirstTestEpisodeView, null);
            var btnAddTest1 = view.FindViewById <Button>(Resource.Id.addtest1);

            btnAddTest1.Focusable            = true;
            btnAddTest1.FocusableInTouchMode = true;
            btnAddTest1.RequestFocus();

            var vm = new TestViewModel();

            vm.Parent = ViewModel;

            ViewModel.AddTestCommandAction = () =>
            {
                vm.EditMode = false;

                var dialogFragment = new TestFragment()
                {
                    DataContext = vm
                };

                dialogFragment.Show(FragmentManager, "T1Episode01");
            };

            ViewModel.CloseTestCommandAction = () =>
            {
                var frag = FragmentManager.FindFragmentByTag("T1Episode01");
                if (null != frag)
                {
                    ((TestFragment)frag).Dismiss();
                }
            };

            ViewModel.EditTestCommandAction = () =>
            {
                vm.EditMode = true;
                var dialogFragment = new TestFragment()
                {
                    DataContext = vm
                };

                dialogFragment.Show(FragmentManager, "T1Episode01");
            };

            return(view);
        }
コード例 #2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            this.EnsureBindingContextIsSet(savedInstanceState);
            var ignored = base.OnCreateView(inflater, container, savedInstanceState);
            var view    = this.BindingInflate(Resource.Layout.FirstHIVTestView, null);

            ViewModel.AddTestCommandAction = () => {
                var dialogFragment = new TestFragment()
                {
                    DataContext = new TestViewModel()
                };

                dialogFragment.Show(FragmentManager, "TEST");
            };
            return(view);
        }