Ejemplo n.º 1
0
        private void BuildInterface()
        {
            HomeLayout = new HomeLayoutView(View.Frame);

            _navigationDrawer = new SFNavigationDrawer
            {
                DrawerHeight = View.Bounds.Height,
                DrawerWidth  = (View.Bounds.Width * 80) / 100
            };

            HomeLayout.MenuButtonTouched = (sender, args) => { _navigationDrawer.ToggleDrawer(); };

            _navigationDrawer.DrawerContentView = new MenuView(View, _navigationDrawer.DrawerWidth, _navigationDrawer.DrawerHeight);

            _navigationDrawer.ContentView = HomeLayout;
            _navigationDrawer.Position    = SFNavigationDrawerPosition.SFNavigationDrawerPositionLeft;
            _navigationDrawer.Transition  = SFNavigationDrawerTransition.SFNavigationDrawerTransitionSlideOnTop;

            if (!UIApplication.SharedApplication.IsRegisteredForRemoteNotifications)
            {
                if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
                {
                    var pushSettings = UIUserNotificationSettings.GetSettingsForTypes(
                        UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound,
                        new NSSet());

                    UIApplication.SharedApplication.RegisterUserNotificationSettings(pushSettings);
                    UIApplication.SharedApplication.RegisterForRemoteNotifications();
                }
                else
                {
                    var notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge |
                                            UIRemoteNotificationType.Sound |
                                            UIRemoteNotificationType.NewsstandContentAvailability;
                    UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
                }
            }
            View.AddSubviews(_navigationDrawer.View);
        }
        private void LoadHeaderView()
        {
            NavigationDrawer = new SFNavigationDrawer
            {
                BackgroundColor = UIColor.Clear,
                ContentView     = content
            };

            menuButton = new UIButton();
            menuButton.SetBackgroundImage(new UIImage("Images/menu.png"), UIControlState.Normal);

            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                NavigationDrawer.DrawerWidth = (this.View.Bounds.Width * 40) / 100;
            }
            else
            {
                NavigationDrawer.DrawerWidth = (this.View.Bounds.Width * 75) / 100;
            }

            NavigationDrawer.DrawerHeight = this.View.Bounds.Height;

            HeaderView = new UIView
            {
                BackgroundColor = UIColor.FromRGBA(249.0f / 255.0f, 78.0f / 255.0f, 56.0f / 255.0f, 0.97f)
            };

            userImg = new UIImageView
            {
                Image = new UIImage("Controls/synclogo.png")
            };

            version = new UILabel
            {
                Text          = "Version " + NSUserDefaults.StandardUserDefaults.ValueForKey(new NSString("VersionNumber")),
                Font          = UIFont.FromName("Helvetica", 12f),
                TextColor     = UIColor.White,
                TextAlignment = UITextAlignment.Left
            };
            HeaderView.AddSubview(version);

            yellowSeperater = new UIView
            {
                BackgroundColor = UIColor.FromRGB(255.0f / 255.0f, 198.0f / 255.0f, 14.0f / 255.0f)
            };
            HeaderView.AddSubview(yellowSeperater);

            headerDetails = new UILabel
            {
                LineBreakMode = UILineBreakMode.WordWrap,
                Lines         = 0,
                Text          = "The toolkit contains all the components that are typically required for building line-of-business applications for IOS",
                TextColor     = UIColor.White,
                Font          = UIFont.FromName("Helvetica", 18f)
            };
            HeaderView.AddSubview(headerDetails);

            HeaderView.AddSubview(userImg);

            Table = new UITableView(new CGRect(0, 20, NavigationDrawer.DrawerWidth, this.View.Frame.Height))
            {
                SeparatorColor = UIColor.Clear
            };

            NavigationTableSource tablesource = new NavigationTableSource(this, GetTableItems())
            {
                Customize = false
            };

            Table.Source          = tablesource;
            Table.BackgroundColor = UIColor.Clear;
            centerview            = new UIView
            {
                Table
            };

            centerview.BackgroundColor = UIColor.Clear;

            NavigationDrawer.Position = SFNavigationDrawerPosition.SFNavigationDrawerPositionLeft;

            menuButton.TouchDown += (object sender, System.EventArgs e) =>
            {
                HideDrawer(false);
            };

            header = new UIView
            {
                BackgroundColor = UIColor.FromRGB(0, 122.0f / 255.0f, 238.0f / 255.0f)
            };

            title = new UILabel
            {
                TextColor = UIColor.White,
                Text      = "Syncfusion Xamarin Samples",
                Font      = UIFont.FromName("HelveticaNeue-Medium", 16f)
            };

            flowLayoutAllControls = new UICollectionViewFlowLayout
            {
                MinimumLineSpacing = 5,
                ScrollDirection    = UICollectionViewScrollDirection.Vertical
            };

            collectionViewAllControls = new UICollectionView(CGRect.Empty, flowLayoutAllControls);
            collectionViewAllControls.RegisterClassForCell(typeof(UICollectionViewCell), "controlCell");
            collectionViewAllControls.DataSource      = new AllControlsCollectionSource(Controls);
            collectionViewAllControls.Delegate        = new AllControlsCollectionDelegate(this);
            collectionViewAllControls.BackgroundColor = Utility.BackgroundColor;

            UINib nibAllControls = UINib.FromName("ControlCell_9", null);

            collectionViewAllControls.RegisterNibForCell(nibAllControls, "controlCell");

            BottomBorder = new CALayer
            {
                BorderWidth = 1,
                BorderColor = UIColor.FromRGB(213.0f / 255.0f, 213.0f / 255.0f, 213.0f / 255.0f).CGColor,
                Hidden      = true
            };

            content.AddSubview(header);
            content.AddSubview(menuButton);
            content.AddSubview(title);
            content.AddSubview(collectionViewAllControls);

            overlay = new CALayer
            {
                ZPosition       = 1000,
                Hidden          = true,
                BackgroundColor = UIColor.FromRGBA(0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 0.05f).CGColor
            };
            content.Layer.AddSublayer(overlay);

            this.View.AddSubview(NavigationDrawer);
        }
        public override void LayoutSubviews()
        {
            //NavigationDrawer initialize
            sideMenuController = new SFNavigationDrawer();
            mainView           = new MainPageView(this.Frame);
            UIButton menubutton = new UIButton();

            menubutton.Frame = new CGRect(10, 10, 30, 30);
            menubutton.SetBackgroundImage(new UIImage("Images/menu.png"), UIControlState.Normal);
            mainView.AddSubview(menubutton);

            sideMenuController.ContentView = mainView;
            if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                sideMenuController.DrawerWidth = (this.Bounds.Width * 40) / 100;
            }
            else
            {
                sideMenuController.DrawerWidth = (this.Bounds.Width * 60) / 100;
            }

            sideMenuController.DrawerHeight = this.Bounds.Height;
            mainView.Frame = new CGRect(0, 0, this.Bounds.Width, this.Bounds.Height);

            //Menu Page Design
            table      = new UITableView(new CGRect(0, 0, sideMenuController.DrawerWidth, this.Frame.Height));        // defaults to Plain style
            tableItems = new string[] { "Home", "Profile", "Inbox", "Outbox", "Sent Items", "Trash" };
            TableSource tablesource = new TableSource(tableItems);

            tablesource.customise      = false;
            table.Source               = tablesource;
            this.BackgroundColor       = UIColor.FromRGB(63, 134, 246);
            HeaderView                 = new UIView();
            HeaderView.Frame           = new CGRect(0, 0, sideMenuController.DrawerWidth, 100);
            HeaderView.BackgroundColor = UIColor.FromRGB(49, 173, 225);
            UIView centerview = new UIView();

            centerview.Frame = new CGRect(0, 100, sideMenuController.DrawerWidth, 500);
            centerview.Add(table);
            usernameLabel               = new UILabel();
            usernameLabel.Frame         = new CGRect(0, 70, sideMenuController.DrawerWidth, 30);
            usernameLabel.Text          = "James Pollock";
            usernameLabel.TextColor     = UIColor.White;
            usernameLabel.TextAlignment = UITextAlignment.Center;
            HeaderView.AddSubview(usernameLabel);

            userImg       = new UIImageView();
            userImg.Frame = new CGRect((sideMenuController.DrawerWidth / 2) - 25, 15, 50, 50);
            userImg.Image = new UIImage("Images/User.png");

            HeaderView.AddSubview(userImg);

            sideMenuController.DrawerHeaderView  = HeaderView;
            sideMenuController.DrawerContentView = centerview;
            sideMenuController.Position          = SFNavigationDrawerPosition.SFNavigationDrawerPositionLeft;

            this.AddSubview(sideMenuController);


            menubutton.TouchDown += (object sender, System.EventArgs e) =>
            {
                sideMenuController.ToggleDrawer();
            };



            foreach (var view in this.Subviews)
            {
                sideMenuController.Frame = new CGRect(0, 0, this.Frame.Width, this.Frame.Height);
                positionLabel.Frame      = new CGRect(this.Frame.X + 10, 0, PopoverSize.Width - 20, 30);
                positionbutton.Frame     = new CGRect(this.Frame.X + 10, 40, PopoverSize.Width - 20, 30);
                transitionLabel.Frame    = new CGRect(this.Frame.X + 10, 90, PopoverSize.Width - 20, 30);
                transitionbutton.Frame   = new CGRect(this.Frame.X + 10, 130, PopoverSize.Width - 20, 30);
                selectionPicker1.Frame   = new CGRect(0, PopoverSize.Height / 2, PopoverSize.Width, PopoverSize.Height / 3);
                selectionPicker2.Frame   = new CGRect(0, PopoverSize.Height / 2, PopoverSize.Width, PopoverSize.Height / 3);
                doneButton.Frame         = new CGRect(0, PopoverSize.Height / 2.5, PopoverSize.Width, 40);
            }
            this.optionView();
        }
		public override void LayoutSubviews ()
		{

			//NavigationDrawer initialize
			sideMenuController = new SFNavigationDrawer ();
			mainView = new MainPageView(this.Frame);
			UIButton bn=new UIButton();
			bn.Frame =new CGRect (10, 10, 30, 30);
			bn.SetBackgroundImage (new UIImage ("Images/menu.png"), UIControlState.Normal);
			mainView.AddSubview (bn);

			sideMenuController.ContentView = mainView;
			if((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
			{
				sideMenuController.DrawerWidth = (this.Bounds.Width*40)/100;
			}
			else
				sideMenuController.DrawerWidth = (this.Bounds.Width*60)/100;

			sideMenuController.DrawerHeight = this.Bounds.Height;
			mainView.Frame = new CGRect (0, 0, this.Bounds.Width, this.Bounds.Height);

			//Menu Page Design
			table = new UITableView(new CGRect(0, 0, sideMenuController.DrawerWidth, this.Frame.Height)); // defaults to Plain style
			tableItems = new string[] {"Home","Profile","Inbox","Outbox","Sent Items","Trash"};
			TableSource sc = new TableSource(tableItems);
			sc.customise = false;
			table.Source = sc;
			this.BackgroundColor = UIColor.FromRGB(63,134,246);
			HeaderView = new UIView ();
			HeaderView.Frame = new CGRect (0, 0, sideMenuController.DrawerWidth, 100);
			HeaderView.BackgroundColor = UIColor.FromRGB (49, 173, 225);
			UIView centerview = new UIView ();
			centerview.Frame = new CGRect (0, 100, sideMenuController.DrawerWidth, 500);
			centerview.Add (table);
			lbe = new UILabel ();
			lbe.Frame =new CGRect (0, 70, sideMenuController.DrawerWidth, 30);
			lbe.Text="James Pollock";
			lbe.TextColor = UIColor.White;
			lbe.TextAlignment = UITextAlignment.Center;
			HeaderView.AddSubview (lbe);

			imageview=new UIImageView();
			imageview.Frame =new CGRect ((sideMenuController.DrawerWidth/2)-25, 15, 50, 50);
			imageview.Image = new UIImage ("Images/User.png");

			HeaderView.AddSubview (imageview);

			sideMenuController.DrawerHeaderView = HeaderView;
			sideMenuController.DrawerContentView = centerview;
			sideMenuController.Position = SFNavigationDrawerPosition.SFNavigationDrawerPositionLeft;

			this.AddSubview (sideMenuController.View);


			bn.TouchDown+= (object sender, System.EventArgs e) => 
			{
				sideMenuController.ToggleDrawer();

			};



			foreach (var view in this.Subviews) {


				label3.Frame = new CGRect (this.Frame.X +10, this.Frame.Y-20, this.Frame.Size.Width - 20, 30);
				textbutton.Frame=new CGRect(this.Frame.X +10, this.Frame.Y+20, this.Frame.Size.Width - 20, 30);	
				label4.Frame = new CGRect (this.Frame.X +10, this.Frame.Y+60, this.Frame.Size.Width - 20, 30);
				textbutton1.Frame=new CGRect(this.Frame.X +10, this.Frame.Y+100, this.Frame.Size.Width - 20, 30);	
				picker1.Frame = new CGRect (0, this.Frame.Size.Height-(this.Frame.Size.Height/3), this.Frame.Size.Width, this.Frame.Size.Height/3);
				picker2.Frame = new CGRect (0, this.Frame.Size.Height-(this.Frame.Size.Height/3), this.Frame.Size.Width , this.Frame.Size.Height/3);
				doneButton.Frame = new CGRect (0, this.Frame.Size.Height-(this.Frame.Size.Height/3), this.Frame.Size.Width, 30);
			}


		}
Ejemplo n.º 5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            //Register Syncfusion license
            Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MTcwMjM0QDMxMzcyZTMzMmUzME5tUkxGQldvU2Voek1QQUJST2hzUmttb2pzZ1RJeHRVak1TTlRTajVGZnc9");

            // Perform any additional setup after loading the view, typically from a nib.
            SFNavigationDrawer navigation = new SFNavigationDrawer();

            this.Add(navigation);
            navigation.Frame = new CGRect(0, 40, this.View.Frame.Width, this.View.Frame.Height);
            navigation.DrawerHeaderHeight = 200;
            navigation.DrawerWidth        = 200;

            // Acts like a android toolbar
            var toolbar = new UIView()
            {
                Frame           = new CGRect(0, 0, View.Bounds.Width, 80),
                BackgroundColor = UIColor.FromRGB(139, 166, 244)
            };
            var addBoardBtn = new UIButton()
            {
                Frame = new CGRect(View.Bounds.Width - 130, 40, 150, 40)
            };

            addBoardBtn.SetTitle("Add Board", UIControlState.Normal);
            addBoardBtn.SetTitleColor(UIColor.White, UIControlState.Normal);
            addBoardBtn.TouchUpInside += delegate {
                View.AddSubview(Dialog.MakeDialog(nameof(Board), this, Dialog.CreateSolitiareType.CreateBoard));
            };
            toolbar.AddSubview(addBoardBtn);


            // Home menu for toggling the navigation
            UIButton menubutton = new UIButton();

            menubutton.Frame = new CGRect(10, 45, 25, 25);
            menubutton.SetBackgroundImage(new UIImage("Images/menu.png"), UIControlState.Normal);

            // When the home button is pressed we will toggle the navigation
            menubutton.TouchUpInside += (object sender, EventArgs e) =>
            {
                navigation.ToggleDrawer();
            };
            toolbar.AddSubview(menubutton);

            // TODO: Make another UIVIEW that will act like the framelayout for the "fragments"

            // Main view that acts as the FrameLayout for fragments
            UIView frameLayout = new UIView(new CGRect(0, toolbar.Bounds.Height, this.View.Frame.Width, this.View.Frame.Height));

            frameLayout.BackgroundColor = UIColor.White;
            // Creating the listview

            // UITableView is not populating the screen with data
            UITableView boardTableView = new UITableView(frameLayout.Bounds);

            boardTableView.Source = new BoardDataSource(this);

            frameLayout.AddSubview(boardTableView);
            // Attaching the home button to the navigation
            // frameLayout.AddSubview(toolbar);
            // Attaching the contentview to the navigation ContentView (toolbar)
            UIView MainUIContainer = new UIView(new CGRect(0, 0, View.Bounds.Width, View.Bounds.Height));

            MainUIContainer.AddSubviews(toolbar, frameLayout);
            navigation.ContentView = MainUIContainer;

            // Acts Acts like the frameLayout for the headerView
            UIView headerView = new UIView(new CGRect(0, 0, navigation.DrawerWidth, 0));

            // Acts like a container for the user's image and name
            UIView HeaderView = new UIView()
            {
                Frame           = new CGRect(0, 70, navigation.DrawerWidth, 0),
                BackgroundColor = UIColor.White
            };
            // Shows the name to the user
            UILabel usernameLabel = new UILabel()
            {
                Frame         = new CGRect(10, 80, navigation.DrawerWidth, 30),
                Text          = (NSString)"Name",
                TextColor     = UIColor.DarkTextColor,
                TextAlignment = UITextAlignment.Left
            };
            // Shows the name to the user
            UILabel userEmail = new UILabel()
            {
                Frame         = new CGRect(10, 100, navigation.DrawerWidth, 30),
                Text          = (NSString)"Email",
                TextColor     = UIColor.Gray,
                TextAlignment = UITextAlignment.Left
            };

            // Adding the user's image and name label to the HeaderView Container UIVIEW
            HeaderView.AddSubview(new UIImageView(UIImage.FromBundle("Images/default_avatar.png"))
            {
                Frame = new CGRect((navigation.DrawerWidth / 2) - 25, 15, 50, 50)
            });
            HeaderView.AddSubview(usernameLabel);
            HeaderView.AddSubview(userEmail);

            // Adding the main header container to the headerView
            headerView.AddSubview(HeaderView);

            // Acts like the FrameLayout for the contents of the drawer layout
            UIView drawerContentView = new UIView(new CGRect(0, 0, navigation.DrawerWidth, 0));

            // Is the container for the contents of the drawer layout
            UIView contentContainer = new UIView(new CGRect(0, 0, navigation.DrawerWidth, View.Bounds.Height));

            contentContainer.BackgroundColor = UIColor.FromRGB(139, 166, 244);



            InitDrawerContents(contentContainer, navigation);


            drawerContentView.AddSubview(contentContainer);
            navigation.DrawerContentView = drawerContentView;
            navigation.DrawerHeaderView  = headerView;
            this.Add(navigation);
        }
		public override void ViewDidLoad()
		{
			base.ViewDidLoad();
			UIView subView = this.View.Subviews[0].Subviews[0];
			subView.RemoveFromSuperview();
			navigation = new SFNavigationDrawer();
			navigation.Frame = new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Height);
			navigation.DrawerHeaderHeight = 0;
			navigation.DrawerWidth = 100;



			UIView contentView = new UIView(new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Height));

			contentView.BackgroundColor = UIColor.Purple;

		

			subView.Frame = new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Height);


		

		


			UIView headerView = new UIView(new CGRect(0, 0, 0, 0));
			UIView HeaderView = new UIView();
			HeaderView.Frame = new CGRect(0, 0, navigation.DrawerWidth, 100);
			HeaderView.BackgroundColor = UIColor.FromRGB(49, 173, 225);
			UILabel usernameLabel = new UILabel();
			usernameLabel.Frame = new CGRect(0, 70, navigation.DrawerWidth, 30);
			usernameLabel.Text = (NSString)"James Pollock";
			usernameLabel.TextColor = UIColor.White;
			usernameLabel.TextAlignment = UITextAlignment.Center;
			HeaderView.AddSubview(usernameLabel);
			UIImageView userImg = new UIImageView();
			userImg.Frame = new CGRect((navigation.DrawerWidth / 2) - 25, 15, 50, 50);
			//userImg.Image = new UIImage("Images/User.png");
			HeaderView.AddSubview(userImg);
			//headerView.AddSubview(HeaderView);

			UIView drawerContentView = new UIView(new CGRect(0, 0, navigation.DrawerWidth, 100));

			UIView centerview = new UIView();
			centerview.Frame = new CGRect(0, 0, navigation.DrawerWidth, 600);

			centerview.BackgroundColor = UIColor.Orange;

			UIButton homeButton11 = new UIButton(new CGRect(0, 0, navigation.DrawerWidth, 25));
			homeButton11.SetTitle("Home", UIControlState.Normal);
			homeButton11.SetTitleColor(UIColor.Black, UIControlState.Normal);
			homeButton11.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
			homeButton11.Layer.CornerRadius = 0;
			homeButton11.Layer.BorderWidth = 1;
			homeButton11.Layer.BorderColor = UIColor.FromRGB(0, 0, 0).CGColor;
			centerview.AddSubview(homeButton11);

			homeButton11.TouchUpInside += delegate
			{
				Console.WriteLine("Home");
				navigation.ToggleDrawer();
			};

			UIButton profileButton = new UIButton(new CGRect(0, 25, navigation.DrawerWidth, 25));
			profileButton.SetTitle("Profile", UIControlState.Normal);
			profileButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
			profileButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
			profileButton.Layer.CornerRadius = 0;
			profileButton.Layer.BorderWidth = 1;
			profileButton.Layer.BorderColor = UIColor.FromRGB(0, 0, 0).CGColor;
			centerview.AddSubview(profileButton);

			UIButton inboxButton = new UIButton(new CGRect(0, 100, navigation.DrawerWidth, 50));
			inboxButton.SetTitle("Inbox", UIControlState.Normal);
			inboxButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
			inboxButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
			inboxButton.Layer.CornerRadius = 0;
			inboxButton.Layer.BorderWidth = 1;
			inboxButton.Layer.BorderColor = UIColor.FromRGB(0, 0, 0).CGColor;
			//centerview.AddSubview(inboxButton);

			UIButton outboxButton = new UIButton(new CGRect(0, 150, navigation.DrawerWidth, 50));
			outboxButton.SetTitle("Outbox", UIControlState.Normal);
			outboxButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
			outboxButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
			outboxButton.Layer.CornerRadius = 0;
			outboxButton.Layer.BorderWidth = 1;
			outboxButton.Layer.BorderColor = UIColor.FromRGB(0, 0, 0).CGColor;
			//centerview.AddSubview(outboxButton);

			UIButton sentItemsButton = new UIButton(new CGRect(0, 200, navigation.DrawerWidth, 50));
			sentItemsButton.SetTitle("SentItems", UIControlState.Normal);
			sentItemsButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
			sentItemsButton.Layer.CornerRadius = 0;
			sentItemsButton.Layer.BorderWidth = 1;
			sentItemsButton.Layer.BorderColor = UIColor.FromRGB(0, 0, 0).CGColor;
			//centerview.AddSubview(sentItemsButton);

			UIButton trashButton = new UIButton(new CGRect(0, 250, navigation.DrawerWidth, 50));
			trashButton.SetTitle("Trash", UIControlState.Normal);
			trashButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
			trashButton.Layer.CornerRadius = 0;
			trashButton.Layer.BorderWidth = 1;
			trashButton.Layer.BorderColor = UIColor.FromRGB(0, 0, 0).CGColor;
			//centerview.AddSubview(trashButton);
			drawerContentView.AddSubview(centerview);

			navigation.DrawerContentView = drawerContentView;
			navigation.DrawerHeaderView = headerView;

















			contentView.AddSubview(subView);
			navigation.ContentView = contentView;
			this.Add(navigation);
			 //Perform any additional setup after loading the view, typically from a nib.
			clickMe.TouchUpInside += delegate
			{
				Console.WriteLine("hh");
				navigation.ToggleDrawer();
			};
		}
Ejemplo n.º 7
0
        private void LoadHeaderView()
        {
            //NavigationDrawer
            navigationDrawer = new SFNavigationDrawer();
            navigationDrawer.BackgroundColor = UIColor.Clear;
            navigationDrawer.ContentView     = content;

            menuButton = new UIButton();
            menuButton.SetBackgroundImage(new UIImage("Images/menu.png"), UIControlState.Normal);

            //navigationDrawer.ContentView = this.View;
            if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                navigationDrawer.DrawerWidth = (this.View.Bounds.Width * 40) / 100;
            }
            else
            {
                navigationDrawer.DrawerWidth = (this.View.Bounds.Width * 75) / 100;
            }

            navigationDrawer.DrawerHeight = this.View.Bounds.Height;

            HeaderView = new UIView();

            HeaderView.BackgroundColor = UIColor.FromRGBA(249.0f / 255.0f, 78.0f / 255.0f, 56.0f / 255.0f, 0.97f);

            userImg = new UIImageView();

            userImg.Image = new UIImage("Controls/synclogo.png");

            version               = new UILabel();
            version.Text          = "Version " + NSUserDefaults.StandardUserDefaults.ValueForKey(new NSString("VersionNumber"));
            version.Font          = UIFont.FromName("Helvetica", 12f);
            version.TextColor     = UIColor.White;
            version.TextAlignment = UITextAlignment.Left;
            HeaderView.AddSubview(version);

            yellowSeperater = new UIView();
            yellowSeperater.BackgroundColor = UIColor.FromRGB(255.0f / 255.0f, 198.0f / 255.0f, 14.0f / 255.0f);
            HeaderView.AddSubview(yellowSeperater);

            headerDetails = new UILabel();
            headerDetails.LineBreakMode = UILineBreakMode.WordWrap;
            headerDetails.Lines         = 0;
            headerDetails.Text          = "The toolkit contains all the components that are typically required for building line-of-business applications for IOS";
            headerDetails.TextColor     = UIColor.White;
            headerDetails.Font          = UIFont.FromName("Helvetica", 18f);
            HeaderView.AddSubview(headerDetails);

            HeaderView.AddSubview(userImg);

            //Menu Page Design
            table = new UITableView(new CGRect(0, 20, navigationDrawer.DrawerWidth, this.View.Frame.Height));             // defaults to Plain style
            table.SeparatorColor = UIColor.Clear;
            tableItems           = new string[] { "Product Page", "Whats New", "Documentation" };
            NavigationTableSource tablesource = new NavigationTableSource(this, tableItems);

            tablesource.customise = false;
            table.Source          = tablesource;
            table.BackgroundColor = UIColor.Clear;
            centerview            = new UIView();
            centerview.Add(table);
            centerview.BackgroundColor = UIColor.Clear;

            navigationDrawer.Position = SFNavigationDrawerPosition.SFNavigationDrawerPositionLeft;

            menuButton.TouchDown += (object sender, System.EventArgs e) =>
            {
                HideDrawer(false);
            };

            //Header View

            header = new UIView();
            header.BackgroundColor = UIColor.FromRGB(0, 122.0f / 255.0f, 238.0f / 255.0f);

            title           = new UILabel();
            title.TextColor = UIColor.White;
            title.Text      = "Syncfusion Xamarin Samples";
            title.Font      = UIFont.FromName("HelveticaNeue-Medium", 16f);

            flowLayoutAllControls = new UICollectionViewFlowLayout();
            flowLayoutAllControls.MinimumLineSpacing = 5;
            flowLayoutAllControls.ScrollDirection    = UICollectionViewScrollDirection.Vertical;
            collectionViewAllControls = new UICollectionView(CGRect.Empty, flowLayoutAllControls);
            collectionViewAllControls.RegisterClassForCell(typeof(UICollectionViewCell), "controlCell");
            collectionViewAllControls.DataSource      = new AllControlsCollectionSource(controls);
            collectionViewAllControls.Delegate        = new AllControlsCollectionDelegate(this);
            collectionViewAllControls.BackgroundColor = Utility.backgroundColor;

            UINib nibAllControls = UINib.FromName("ControlCell_9", null);

            collectionViewAllControls.RegisterNibForCell(nibAllControls, "controlCell");

            bottomBorder             = new CALayer();
            bottomBorder.BorderWidth = 1;
            bottomBorder.BorderColor = (UIColor.FromRGB(213.0f / 255.0f, 213.0f / 255.0f, 213.0f / 255.0f)).CGColor;
            bottomBorder.Hidden      = true;

            content.AddSubview(header);
            content.AddSubview(menuButton);
            content.AddSubview(title);
            content.AddSubview(collectionViewAllControls);

            overlay                 = new CALayer();
            overlay.ZPosition       = 1000;
            overlay.Hidden          = true;
            overlay.BackgroundColor = (UIColor.FromRGBA(0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 0.05f)).CGColor;
            content.Layer.AddSublayer(overlay);

            this.View.AddSubview(navigationDrawer);
        }