protected override void OnElementChanged(VisualElement oldElement, VisualElement newElement)
        {
            base.OnElementChanged(oldElement, newElement);

            if (oldElement != null)
            {
                oldElement.PropertyChanged  -= this.HandleMasterDetailPagePropertyChanged;
                oldElement.PropertyChanging -= this.HandleMasterDetailPagePropertyChanging;
            }

            if (newElement != null)
            {
                newElement.PropertyChanged  += this.HandleMasterDetailPagePropertyChanged;
                newElement.PropertyChanging += this.HandleMasterDetailPagePropertyChanging;
            }

            if (oldElement == null && newElement != null)
            {
                this.SetFitsSystemWindows(true);

                var activity = (Activity)this.Context;

                this.actionBarDrawerToggle = new CustomActionBarDrawerToggle(this, activity, this)
                {
                    DrawerIndicatorEnabled = true
                };

                this.ActionBar.SetDisplayHomeAsUpEnabled(true);
                this.ActionBar.SetHomeButtonEnabled(true);
                this.ActionBar.SetTitle(Resource.String.navigation_drawer_open);
                this.actionBarDrawerToggle.SyncState();
                this.ActionBar.Elevation = 8;
                this.BindNavigationEventHandlers();
            }
        }
        protected override void OnElementChanged(VisualElement oldElement, VisualElement newElement)
        {
            base.OnElementChanged(oldElement, newElement);

            if (oldElement != null)
            {
                oldElement.PropertyChanged -= this.HandleMasterDetailPagePropertyChanged;
                oldElement.PropertyChanging -= this.HandleMasterDetailPagePropertyChanging;
            }

            if (newElement != null)
            {
                newElement.PropertyChanged += this.HandleMasterDetailPagePropertyChanged;
                newElement.PropertyChanging += this.HandleMasterDetailPagePropertyChanging;
            }

            if (oldElement == null && newElement != null)
            {
                this.SetFitsSystemWindows(true);

                var activity = (Activity)this.Context;

                this.actionBarDrawerToggle = new CustomActionBarDrawerToggle(this, activity, this) { DrawerIndicatorEnabled = true };

                this.ActionBar.SetDisplayHomeAsUpEnabled(true);
                this.ActionBar.SetHomeButtonEnabled(true);

                this.actionBarDrawerToggle.SyncState();

                this.BindNavigationEventHandlers();
            }
        }
示例#3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it

            ins            = this;
            mStackFragment = new Stack <Android.Support.V4.App.Fragment>();
            mToolbar       = FindViewById(Resource.Id.toolbar) as SupportToolbar;
            mDrawerLayout  = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);


            mStackFragment = new Stack <Android.Support.V4.App.Fragment>();

            ShowSideMenu(true);


            ShowSideMenu(true);
            mNavigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            mNavigationView.NavigationItemSelected += mNavigationView_NavigationItemSelected;

            SetSupportActionBar(mToolbar);

            //var trans = SupportFragmentManager.BeginTransaction();
            //trans.Replace(Resource.Id.fragmentContainer, new fragLogin(), "login");
            //trans.Commit();

            var trans = SupportFragmentManager.BeginTransaction();

            trans.Replace(Resource.Id.fragmentContainer, new fragLogin(), "login");
            trans.Commit();

            mDrawerToggle = new CustomActionBarDrawerToggle(
                this,
                mDrawerLayout,
                Resource.String.openedDrawer,
                Resource.String.closedDrawer);

            mDrawerLayout.AddDrawerListener(mDrawerToggle);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowTitleEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.Hide();
            mDrawerToggle.SyncState();

            SupportActionBar.Title = "PSU Upate";
        }